WebKit JS

RSS for tag

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

Posts under WebKit JS tag

200 Posts

Post

Replies

Boosts

Views

Activity

music webkit MusicKit.getInstance(); return undefined
we need to play songs auto play but const music = MusicKit.getInstance(); return undefined try { MusicKit.configure({ developerToken: DEVELOPER_TOKEN, app: { name: 'ReflexRadioDev', build: '1978.4.1', }, }); } catch (err) { console.log("my : " + err); } // MusicKit instance is available const music = MusicKit.getInstance(); console.log(music); we use version 3 from apple music kit "https://js-cdn.music.apple.com/musickit/v3/musickit.js" browser console error :- Uncaught (in promise) TypeError: music is undefined https://dev2.api.app.reflex-radio.com/index.html:78 dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 setTimeout handler*dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1 index.html:78:7 https://dev2.api.app.reflex-radio.com/index.html:185 dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 (Async: setTimeout handler) dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1
1
0
832
Jul ’22
WKWebview insdie UITableviewcell with dynamic height
Hello, I have used WKWebview inside my tableview cell and given constraint inside my xib file. I am loading html text in webview which i get from server side in api and i have taken webview height constraint property for update height on did finish delegate method. It's not working proper and not giving proper height and on scroll every-time it's rendering with different height. My requirement is i want to display math equations and html content on webview with dynamic height of cell. I have done research and tried everything but it's not working. I am using below code for update webview height. func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {     webView.evaluateJavaScript("document.readyState", completionHandler: { (ready, error) in       if ready != nil {         DispatchQueue.main.asyncAfter(deadline: .now()) {           webView.evaluateJavaScript("document.body.scrollHeight") { [weak self] (result, _) in             guard let self = self, let result = result as? Double else { return }             self.webViewHeightConstraint.constant = CGFloat(result)             self.webView.updateConstraints()            }         }       }     })   }     Please help me to solve this issue. Thank you
0
0
1.6k
Jul ’22
[bug] iPad Safari fullscreen error when triggered following a pointerdown event
When triggering a webkitRequestFullscreen event in response to a pointerdown event, the result is a fullscreen error. Using a pointerup event instead of pointerdown works fine. I'm using a <button> element to receive the event and in the event listener callback I'm attempting to call webkitRequestFullscreen() on a div. Is this expected behavior? note: this was observed using MacOS Simulator: iPad 9th Generation - iOS 15.4
0
0
1k
Jun ’22
My account seems to be registered under a apple business management account... and it seems the MDM is preventing me from having ful access of my original Apple ID (“the user you entered is invalid”) ... spoke with a apple representative last week
The original Apple ID according to the representative is still “active” however she did hang up in my face when she used my Government name and that name wasn’t initially registered to the original Apple ID.. anyways the restrictions that correspond with a MDM from an apple business management account on my iPhone also the analytics and improvements keep showing activity of another device having access or “remote” capabilities. I copied this portion of some crash reports from the analytics data Heaviest stack for the target process: 10 ??? (libsystempthread.dylib + 6976) [0x1e79aab40] 10 ??? (QuartzCore + 1891396) [0x1a1a14c44] 7 ??? (QuartzCore + 1833980) [0x1a1a06bfc] 7 ??? (CoreFoundation + 635644) [0x19e50a2fc] 7 ??? (CoreFoundation + 631324) [0x19e50921c] 7 ??? (CoreFoundation + 635020) [0x19e50a08c] 7 ??? (CoreFoundation + 660344) [0x19e510378] 7 ??? (CoreFoundation + 663528) [0x19e510fe8] 7 ??? (CoreFoundation + 511440) [0x19e4ebdd0] 7 ??? (QuartzCore + 971636) [0x1a1934374] 7 ??? (QuartzCore + 1833040) [0x1a1a06850] 3 ??? (QuartzCore + 1774248) [0x1a19f82a8] 3 ??? (QuartzCore + 2141416) [0x1a1a51ce8] 2 ??? (QuartzCore + 1043980) [0x1a1945e0c] 2 ??? (Metal + 702968) [0x1b42c39f8] 2 ??? (libdispatch.dylib + 75840) [0x19e197840] 2 ??? (libdispatch.dylib + 15792) [0x19e188db0] 2 ??? (Metal + 703044) [0x1b42c3a44] 2 ??? (Metal + 701656) [0x1b42c34d8] 2 ??? (IOGPU + 23412) [0x1da745b74] 2 ??? (IOGPU + 24252) [0x1da745ebc] 2 ??? (IOGPU + 71780) [0x1da751864] 2 ??? (IOKit + 33612) [0x1a929734c] 2 ??? (IOKit + 531692) [0x1a9310cec] 2 ??? (libsystemkernel.dylib + 17104) [0x1cb46f2d0] Also here’s a log of some activity from a MDMiosagent. If anyone had any answers as to how to remove my account from a MDM (unenroll). My device was added to a management account without my consent or authorization.. and this “crime” needs to be reported immediately. I’ll post that on another question bold
2
0
2.2k
Jun ’22
Memory leak occurs when using WKWebView in swiftui
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) } }
0
1
1.7k
May ’22
WKWebview websocket compression is broken
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?
0
0
968
May ’22
wasm on iOS app
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.
0
0
2.9k
May ’22
WKWebView -How to AutoPlay Video Without VideoID?
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() }
0
0
2.7k
Apr ’22
evaluateJavaScript:completionHandler: Works on iPhone, not on iPad?
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]; }
0
0
1.1k
Apr ’22
iOS 15 WkWebView BUG - Cannot draw the video content into canvas
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
3
0
2.8k
Mar ’22
WebKit functioning with NPAPI plugins in MacOS Monterey
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 ?
0
0
1.1k
Mar ’22
View elements (in HTML/webkit esp at the top) disappear after returning to a page
I feel this may be a HTML5/Webkit bug related to the canvas element or the way it is repainted (when control comes to that view (I mean page) after going to some other view) when the view is re-rendered, please correct me if this is wrong based on the description. This bug appears to be a generic one observed on iOS 14 & above on both iPhone and iPAD. The bug does not appear till iOS 13.6 (verified on iPAD Air 2019 iOS v13.6) The bug is as follows: The view elements (say text box, input .. esp those at the top) are rendered correctly when the user visits a page first time (e.g. as in goes from page 1 to page 2, then the view elements in page 2 are rendered correctly). Now if the user goes back from page 2 to page 1 & then revisits page 2, the view elements (esp those at the top) disappear. The following video clips can help understand this better: #1 2 mins: https://drive.google.com/file/d/1ycO3YcJeSMA8kmDm6g9ciLUdbEQ-TNbC/view?usp=sharing #2 Less than 25 secs : https://drive.google.com/file/d/1bUBkHQaC0bn6FofLZz2KXTRTg78rF0mx/view?usp=sharing (Please look at both clips) Now if one were to pull and drag down the screen/canvas area at the place where these view elements were originally, then the view elements show up (it's just that they have somehow "gone over the top" after we want back to the earlier page) look at this video clip : https://drive.google.com/file/d/1LKYkqNRrDIE2-f61amMu_gv2QK8lNQf-/view?usp=sharing This bug has been observed in the "HTR Resistor Finder" app using Sencha Touch/Cordova (App store link: https://apps.apple.com/us/app/htr-resistor-finder/id923363496 ). The app has worked perfectly well iOS 7 onwards till iOS 13.6 as also it's working well in all versions of Android 4 onwards till 11, that is the latest Android version. The bug appears to have been introduced due to changes in Webkit in iOS 14 onwards. A bug has been already in Webkit bugzilla https://bugs.webkit.org/show_bug.cgi?id=229231 Please confirm this is being looked into. Hope this can be addressed soon!
1
0
1.1k
Feb ’22
Safari 15 is (randomly) killing WkWebView instance
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
0
0
888
Feb ’22
After executing canMakePayments, an error occurs when executing window.webkit.messageHandlers.xxxx.postMessage.
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.xxx.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?
1
0
736
Feb ’22
XSLTProccessor.importStylesheet does not resolve xsl:include references in the imported stylesheet
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);
0
0
588
Feb ’22
music webkit MusicKit.getInstance(); return undefined
we need to play songs auto play but const music = MusicKit.getInstance(); return undefined try { MusicKit.configure({ developerToken: DEVELOPER_TOKEN, app: { name: 'ReflexRadioDev', build: '1978.4.1', }, }); } catch (err) { console.log("my : " + err); } // MusicKit instance is available const music = MusicKit.getInstance(); console.log(music); we use version 3 from apple music kit "https://js-cdn.music.apple.com/musickit/v3/musickit.js" browser console error :- Uncaught (in promise) TypeError: music is undefined https://dev2.api.app.reflex-radio.com/index.html:78 dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 setTimeout handler*dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1 index.html:78:7 https://dev2.api.app.reflex-radio.com/index.html:185 dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 (Async: setTimeout handler) dispatchDocumentEvent https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:44 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1 https://js-cdn.music.apple.com/musickit/v3/musickit.js:1
Replies
1
Boosts
0
Views
832
Activity
Jul ’22
WKWebview insdie UITableviewcell with dynamic height
Hello, I have used WKWebview inside my tableview cell and given constraint inside my xib file. I am loading html text in webview which i get from server side in api and i have taken webview height constraint property for update height on did finish delegate method. It's not working proper and not giving proper height and on scroll every-time it's rendering with different height. My requirement is i want to display math equations and html content on webview with dynamic height of cell. I have done research and tried everything but it's not working. I am using below code for update webview height. func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {     webView.evaluateJavaScript("document.readyState", completionHandler: { (ready, error) in       if ready != nil {         DispatchQueue.main.asyncAfter(deadline: .now()) {           webView.evaluateJavaScript("document.body.scrollHeight") { [weak self] (result, _) in             guard let self = self, let result = result as? Double else { return }             self.webViewHeightConstraint.constant = CGFloat(result)             self.webView.updateConstraints()            }         }       }     })   }     Please help me to solve this issue. Thank you
Replies
0
Boosts
0
Views
1.6k
Activity
Jul ’22
[bug] iPad Safari fullscreen error when triggered following a pointerdown event
When triggering a webkitRequestFullscreen event in response to a pointerdown event, the result is a fullscreen error. Using a pointerup event instead of pointerdown works fine. I'm using a <button> element to receive the event and in the event listener callback I'm attempting to call webkitRequestFullscreen() on a div. Is this expected behavior? note: this was observed using MacOS Simulator: iPad 9th Generation - iOS 15.4
Replies
0
Boosts
0
Views
1k
Activity
Jun ’22
WKWebView javascript execution when app is in background
hello. Switch the app to background when loading a webpage in webview, webpage's JavaScript will stop working. Resume the app webpage fails to load and the screen is not drawn. Any solution?
Replies
0
Boosts
0
Views
720
Activity
Jun ’22
My account seems to be registered under a apple business management account... and it seems the MDM is preventing me from having ful access of my original Apple ID (“the user you entered is invalid”) ... spoke with a apple representative last week
The original Apple ID according to the representative is still “active” however she did hang up in my face when she used my Government name and that name wasn’t initially registered to the original Apple ID.. anyways the restrictions that correspond with a MDM from an apple business management account on my iPhone also the analytics and improvements keep showing activity of another device having access or “remote” capabilities. I copied this portion of some crash reports from the analytics data Heaviest stack for the target process: 10 ??? (libsystempthread.dylib + 6976) [0x1e79aab40] 10 ??? (QuartzCore + 1891396) [0x1a1a14c44] 7 ??? (QuartzCore + 1833980) [0x1a1a06bfc] 7 ??? (CoreFoundation + 635644) [0x19e50a2fc] 7 ??? (CoreFoundation + 631324) [0x19e50921c] 7 ??? (CoreFoundation + 635020) [0x19e50a08c] 7 ??? (CoreFoundation + 660344) [0x19e510378] 7 ??? (CoreFoundation + 663528) [0x19e510fe8] 7 ??? (CoreFoundation + 511440) [0x19e4ebdd0] 7 ??? (QuartzCore + 971636) [0x1a1934374] 7 ??? (QuartzCore + 1833040) [0x1a1a06850] 3 ??? (QuartzCore + 1774248) [0x1a19f82a8] 3 ??? (QuartzCore + 2141416) [0x1a1a51ce8] 2 ??? (QuartzCore + 1043980) [0x1a1945e0c] 2 ??? (Metal + 702968) [0x1b42c39f8] 2 ??? (libdispatch.dylib + 75840) [0x19e197840] 2 ??? (libdispatch.dylib + 15792) [0x19e188db0] 2 ??? (Metal + 703044) [0x1b42c3a44] 2 ??? (Metal + 701656) [0x1b42c34d8] 2 ??? (IOGPU + 23412) [0x1da745b74] 2 ??? (IOGPU + 24252) [0x1da745ebc] 2 ??? (IOGPU + 71780) [0x1da751864] 2 ??? (IOKit + 33612) [0x1a929734c] 2 ??? (IOKit + 531692) [0x1a9310cec] 2 ??? (libsystemkernel.dylib + 17104) [0x1cb46f2d0] Also here’s a log of some activity from a MDMiosagent. If anyone had any answers as to how to remove my account from a MDM (unenroll). My device was added to a management account without my consent or authorization.. and this “crime” needs to be reported immediately. I’ll post that on another question bold
Replies
2
Boosts
0
Views
2.2k
Activity
Jun ’22
BeforeUnLoad event not working in wkwebview
unload, pagehide event works in wkwebview. However, when i try to add beforeunload event listener, it won't get called in wkwebview.
Replies
0
Boosts
0
Views
1.6k
Activity
Jun ’22
Memory leak occurs when using WKWebView in swiftui
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) } }
Replies
0
Boosts
1
Views
1.7k
Activity
May ’22
WKWebview websocket compression is broken
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?
Replies
0
Boosts
0
Views
968
Activity
May ’22
Web audio context stop in background after ios 15.5
I have a web app it broken after las update ios release. The sound was played with Web audio context stop when the application change to run over background
Replies
0
Boosts
0
Views
874
Activity
May ’22
Is there a way to use Chrome instead of Safari in WKWebview?
My app loads a webview using WKWebView class, so it uses safari to render the web content. However, the content is quite complex and Chrome does perform considerably better than Safari. So i wonder if would be possible to use Chrome engine in WKWebview, instead of Safari.
Replies
1
Boosts
0
Views
2.6k
Activity
May ’22
wasm on iOS app
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.
Replies
0
Boosts
0
Views
2.9k
Activity
May ’22
WKWebView -How to AutoPlay Video Without VideoID?
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() }
Replies
0
Boosts
0
Views
2.7k
Activity
Apr ’22
evaluateJavaScript:completionHandler: Works on iPhone, not on iPad?
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]; }
Replies
0
Boosts
0
Views
1.1k
Activity
Apr ’22
iOS 15 WkWebView BUG - Cannot draw the video content into canvas
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
Replies
3
Boosts
0
Views
2.8k
Activity
Mar ’22
WebKit functioning with NPAPI plugins in MacOS Monterey
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 ?
Replies
0
Boosts
0
Views
1.1k
Activity
Mar ’22
View elements (in HTML/webkit esp at the top) disappear after returning to a page
I feel this may be a HTML5/Webkit bug related to the canvas element or the way it is repainted (when control comes to that view (I mean page) after going to some other view) when the view is re-rendered, please correct me if this is wrong based on the description. This bug appears to be a generic one observed on iOS 14 & above on both iPhone and iPAD. The bug does not appear till iOS 13.6 (verified on iPAD Air 2019 iOS v13.6) The bug is as follows: The view elements (say text box, input .. esp those at the top) are rendered correctly when the user visits a page first time (e.g. as in goes from page 1 to page 2, then the view elements in page 2 are rendered correctly). Now if the user goes back from page 2 to page 1 & then revisits page 2, the view elements (esp those at the top) disappear. The following video clips can help understand this better: #1 2 mins: https://drive.google.com/file/d/1ycO3YcJeSMA8kmDm6g9ciLUdbEQ-TNbC/view?usp=sharing #2 Less than 25 secs : https://drive.google.com/file/d/1bUBkHQaC0bn6FofLZz2KXTRTg78rF0mx/view?usp=sharing (Please look at both clips) Now if one were to pull and drag down the screen/canvas area at the place where these view elements were originally, then the view elements show up (it's just that they have somehow "gone over the top" after we want back to the earlier page) look at this video clip : https://drive.google.com/file/d/1LKYkqNRrDIE2-f61amMu_gv2QK8lNQf-/view?usp=sharing This bug has been observed in the "HTR Resistor Finder" app using Sencha Touch/Cordova (App store link: https://apps.apple.com/us/app/htr-resistor-finder/id923363496 ). The app has worked perfectly well iOS 7 onwards till iOS 13.6 as also it's working well in all versions of Android 4 onwards till 11, that is the latest Android version. The bug appears to have been introduced due to changes in Webkit in iOS 14 onwards. A bug has been already in Webkit bugzilla https://bugs.webkit.org/show_bug.cgi?id=229231 Please confirm this is being looked into. Hope this can be addressed soon!
Replies
1
Boosts
0
Views
1.1k
Activity
Feb ’22
Storage API gives inexplicable "Storage Quota Exceeded" error
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.
Replies
0
Boosts
0
Views
731
Activity
Feb ’22
Safari 15 is (randomly) killing WkWebView instance
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
Replies
0
Boosts
0
Views
888
Activity
Feb ’22
After executing canMakePayments, an error occurs when executing window.webkit.messageHandlers.xxxx.postMessage.
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.xxx.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?
Replies
1
Boosts
0
Views
736
Activity
Feb ’22
XSLTProccessor.importStylesheet does not resolve xsl:include references in the imported stylesheet
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);
Replies
0
Boosts
0
Views
588
Activity
Feb ’22