WebKit JS

RSS for tag

Access and modify DOM elements within a webpage, including touch events and visual effects, using WebKit JS.

WebKit JS Documentation

Posts under WebKit JS tag

46 Posts
Sort by:
Post not yet marked as solved
1 Replies
406 Views
I have a game that is built as a PWA and the minute I add sounds that overlap, everything goes to pot on mobile. The sounds work perfectly on desktop, but on an iPhone X the behavior is drawing and sounds get randomly delayed and serialized. So even though on the desktop the visual of a block dropping is accompanied by the sound of a block dropping, on mobile I get one or the other first, and if I do 16 in a row, I'll get some set of each before or after one another (3 sounds, 8 visual animations, 6 sounds, 5 visual animations, 2 sound, 3 visual animations). I'd rather not use a dependency like Howler.js, but have decided to do so. I've tried both DOM audio elements and new Audio() objects in javascript. Nothing seems to make it better. Thoughts? To see this in action - https://staging.likeme.games
Posted
by
Post not yet marked as solved
0 Replies
357 Views
Hi, I am working with an ios app which calls a survey Web app and displays a survey embedded in the ios app. In the survey app I have setup a redirect url, but this is not working. The expected behaviour is that the webbrowser would open the url. But this is not triggering the browser to open. The html code that I am using is a Windows.top.
Posted
by
Post not yet marked as solved
0 Replies
377 Views
Hello, why i cant access to IndexedDB data, created by serviceworker, from DOM? It is different databeses? On all other browsers i can save data in ServiceWorker into IndexedDB and read it in Dom from IndexedDb with same name, But it not work on Mobile Safari, for what it not shared now?
Posted
by
Post not yet marked as solved
0 Replies
279 Views
Hi Apple team, I am using an API request to download a pdf (or a .doc) file from our servers. Most browsers support createObjectURL(blob), however for IE and EDGE , We have been using msSaveOrOpenBlob to save the blob data. iOS Edge browser, however, neither does not support msSaveOrOpenBlob nor does respond to createObjectURL. So what should I do to download a file in iOS edge? Thank you, Koushik Kuppanna
Post not yet marked as solved
3 Replies
931 Views
Hi all, I encounter a WkWebView BUG that only happens on iOS 15 WkWebView. I wonder if anyone knows how to work around this bug. In canvas API, we can use 2d context's drawImage() to draw video content into a canvas. I found in iOS 15 WkWebView failed to draw video content if the video source is a m3u8 HLS video stream. This bug only happens in WkWebView, not Safari. And only happens in m3u8 video source, a mp4 video source works, too. Here is a sample page to demo this bug. It works in Safari, but doesn't work in Google Chrome because Chrome is using WkWebView. https://dev-us3.cloudmosa.com/~suyuan/test/video_canvas/canvas.html Thanks, Sam
Posted
by
Post not yet marked as solved
0 Replies
266 Views
On the payment screen of my website, I executed the canMakePayments method to check if the user has an ApplePay-enabled device. The process worked fine, but when I executed the window.webkit.messageHandlers.xxxx.postMessage method in JS to do the following, the process stopped. window.webkit.messageHandlers.***.postMessage is it not possible to use it when using ApplePayJS? Or is there some problem such as a restriction on the JS window object?
Posted
by
Post not yet marked as solved
0 Replies
194 Views
The javascript code below fails when the xsl transformation passed to the importStylesheet contains xsl:include href= references. No exception is thrown and the transformToFragment function simply returns null. This works on all other browsers except Safari. For Safari all xsl:include href references must be manually resolved and inserted into the XSL transformation document prior to calling transformToFragment. Is this a known bug? Is there a workaround aside from retrieving all xsl:include href manually? //Opera, Firefox, Chrome, Safari ... processor = new XSLTProcessor(); processor.importStylesheet(settings.xslDocument); if(settings.param) { for(var param = settings.param.length; param--;) { processor.setParameter(null, settings.param[param].name, settings.param[param].value); } } transformedXML = processor.transformToFragment(settings.xmlDocument, document);
Posted
by
Post not yet marked as solved
0 Replies
302 Views
I have a Safari App Extension that uses an instance of WkWebView to run JavaScript code. This app extension runs flawlessly with Safari 13 & 14, but Safari 15 occasionally kills the WkWebView instance for no apparent reason. The only thing logged to the console is this message: (JavaScriptCore) Received an invalid message "<unknown message receiver>.<unknown message>" from the web process. SafariExtension: (WebKit) [com.apple.WebKit:Process] 0x10c2e9300 - WebProcessProxy didClose (web process crash) SafariExtension: (WebKit) [com.apple.WebKit:Process] 0x7ff1e7048020 - [pageProxyID=5, webPageID=6, PID=22131] WebPageProxy::processDidTerminate: (pid 22131), reason 3 I can't find any correlation between the JavaScript that's running and that error. The error seemingly occurs at random. Has anyone else experienced such a problem? Thanks
Posted
by
Post not yet marked as solved
0 Replies
240 Views
I'm getting a "Storage Quota Exceeded" error when adding to the extension's sync storage area. getBytesInUse returns 88824, but trying to add {test: 'test'} gives the error. See attached screen shot. Safari version is 15.1, macOS version is 12.0.1. My available disk space is 523GB, so that's not the problem.
Posted
by
Post not yet marked as solved
0 Replies
331 Views
Hi all, Need help !!!!!!!!!!! We have a desktop application which runs on OSX, but currently on Mac OS Monterey, the console UI part of the application is not showing up. It was showing up fine on MacOS Big Sur and earlier versions of OSX. The console UI of the application is written using WebKit and JavaScript (jQuery), which internally makes use of NPAPI plugin to call native code from JavaScript. The WebKit tries to load the NPAPI plugin module, which is registered to the OSX and is placed under /Library/Internet Plug-Ins. Until MacOS Big Sur, the application console UI was showing up since WebKit was able to load the registered plugin module successfully. Now on MacOS Monterey, the console UI is not showing up. We are assuming that this issue is due to the fact that registered plugin loading by WebKit in MacOS Monterey is failing. Can somebody please tell, if NPAPI plugins are deprecated from MacOS Monterey and is there any workaround for this issue ?
Posted
by
Post not yet marked as solved
0 Replies
243 Views
I have a mobile app which is uses Web authentication PublickKeyCredential api provided by WebKit to authenticate users and use oauth token from the response to login to the app. Since iOS 15.4 released this following snippet is returning false window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable Please provide a workaround or let me know when this will get fix in WebKit
Posted
by
Post not yet marked as solved
0 Replies
210 Views
My app has HTML pages for content, and I have a button-triggered action to change the size of the text by using a set of functions that stepwise increases the WebKit webview text by changing the class of the document body (i.e."smallestText" = CSS webkit-text-size-adjust:80%) using the code below as the last step. On the iPhone simulator, this works perfectly but on the iPad simulator the text size does not change even though the functions are called, the javascriptString is correct, and the _webview contains the web content. I thought this might be a doctype version issue (most of the pages are HTML 4.01 strict) but changed it to HTML5 (!DOCTYPE html) with no change. Any ideas? (void)refreshWebview { NSString *javaScriptString = [NSString stringWithFormat:@"document.body.className = '%@'", self.fontSizeName]; [_webview evaluateJavaScript:javaScriptString completionHandler:nil]; }
Posted
by
Post not yet marked as solved
0 Replies
191 Views
In my app I use WKWebView and the user can go to different websites like google, wikipedia, vimeo, etc. The issue is if the user decides to go to https://www.youtube.com, when the user taps a thumbnail to play it, it doesn't autoplay because I don't have the videoId (eg. "https://youtu.be/MpvshzR6tNk"), I just have the the youtube website url For example: func loadRequest() { let strThatUserEntered = "https://youtube.com" let urlStr = "strThatUserEntered" guard let url = URL(string: urlStr), let request = URLRequest(url: url) else { return } wkWebView.load(request) wkWebView.allowsBackForwardNavigationGestures = true } Now when the user selects a random thumbnail, the video loads, the youtube play button appears, and when it's pressed, I get: An error occurred, please try again later (this video definitely works) How can I enable autoplay on any selected youtube thumbnail , if I don't have the videoID? code: override func viewDidLoad() super.viewDidLoad() let webConfiguration = WKWebViewConfiguration() webConfiguration.allowsInlineMediaPlayback = true webConfiguration.mediaTypesRequiringUserActionForPlayback = [] wkWebView = WKWebView(frame: .zero, configuration: webConfiguration) wkWebView.navigationDelegate = self wkWebView.uiDelegate = self // pin wkWebView anchors to screen loadRequest() }
Posted
by
Post not yet marked as solved
0 Replies
341 Views
Hi I would like to ask if the webassembly technology is supported by wkwebview or if there are particular limitations. The second question is once an app has been developed where I have some sections inside that make use of web assembly modules, is it possible to publish them on the appstore or are there limitations? thanks for the replies.
Post not yet marked as solved
0 Replies
159 Views
I have the websocket server which enables permessage-deflate to compress massive data. The problem is when I try to use it in webview, the connection was closed. I learned from other discussion that it can be solved by disabling Setting safari =>Advanced=>Experimental Features=>NSURLSession WebSocket, but only for Safari. How can I solve the problem in WKWebview? Or when will the problem be solved?
Posted
by
Post not yet marked as solved
0 Replies
147 Views
When I learned to use webview in my app, just added a webview and detected a memory leak, import SwiftUI import WebKit struct SWKWebView: UIViewRepresentable { @Binding var url: String? func makeUIView(context: Context) -> WKWebView { let webview = WKWebView() webview.navigationDelegate = context.coordinator return webview } func updateUIView(_ uiView: WKWebView, context: Context) { if let url = url, let requetURL = URL(string: url) { uiView.load(URLRequest(url: requetURL)) } } func makeCoordinator() -> Coordinator { Coordinator() } class Coordinator: NSObject,WKNavigationDelegate { func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { webView.evaluateJavaScript("document.title") { (result, error) in print("didFinish:\(String(describing: result ?? ""))") } } } } struct TTTest: View { @State var url: String? = "https://www.google.com" var body: some View { SWKW ![]("https://developer.apple.com/forums/content/attachment/d4b6a729-f217-4b1a-9ec4-1372643e14b4" "title=WeChatc57286e9fa2eb9bc5d59b7410d876c33.png;width=1788;height=660") ebView(url: $url) } }
Posted
by