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
0 Replies
13 Views
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
Posted
by fathi.
Last updated
.
Post not yet marked as solved
0 Replies
58 Views
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
Posted
by hitler48.
Last updated
.
Post not yet marked as solved
0 Replies
94 Views
Hi, I'm trying to implement the async handler of WKScriptMessageHandlerWithReply -> see yellow box in this reference. This is the method signature: func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) async -> (Any?, String?) But I end up with a Segmentation fault: 11 compilation error. I'm compiling with Xcode 13.4.1 (13F100). Did anybody successfully use this API or now a solution to fix it?
Posted Last updated
.
Post not yet marked as solved
0 Replies
128 Views
I am creating a react app and am making use of Webauthn to use TouchID or FaceID for user authentication. I have built my app so that when the button is clicked, navigator.credentials.create is the only call made. With attestation set to none, there are no issues however as soon as I set attestation to direct I get an alert saying 'The operation can't be completed' and 'NotAllowedError: This request has been cancelled by the user.' is logged to console. The issue only presents itself on Safari and iOS devices however works perfectly on other browsers like Chrome. Has anyone encountered a similar issue and possibly know how to resolve it? Thanks Shay
Posted
by shay_.
Last updated
.
Post not yet marked as solved
0 Replies
129 Views
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
Posted
by dbuss1.
Last updated
.
Post not yet marked as solved
2 Replies
840 Views
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
Posted
by laroy0731.
Last updated
.
Post not yet marked as solved
0 Replies
146 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 acsa.
Last updated
.
Post not yet marked as solved
0 Replies
158 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 Last updated
.
Post not yet marked as solved
1 Replies
233 Views
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.
Posted Last updated
.
Post not yet marked as solved
0 Replies
340 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.
Posted Last updated
.
Post not yet marked as solved
0 Replies
190 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 lance145.
Last updated
.
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 DrMiller.
Last updated
.
Post not yet marked as solved
0 Replies
242 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 AnkitC.
Last updated
.
Post not yet marked as solved
3 Replies
929 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 suyuan.
Last updated
.
Post not yet marked as solved
0 Replies
329 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 mishraab.
Last updated
.
Post not yet marked as solved
0 Replies
598 Views
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!
Posted Last updated
.
Post not yet marked as solved
0 Replies
239 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 jackrg.
Last updated
.