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
759 Views
Service Workers are difficult to debug without proper tooling. Current tools available in Safari makes it difficult to understand the lifecycle of the SW, the Cache Storage contents, to reload or remove registration and other actions. It's even more difficult when doing remote debugging to an iOS or iPadOS device where the Service Workers appears as a different context without proper explanation.
Posted
by
Post not yet marked as solved
2 Replies
1.7k Views
My app has a WKWebView which loads the certain HTML, CSS and JavaScript files. When the WKWebView is opened and files load initially, the memory usage of my app remains relatively low. If I start to use the application, in some time (5 mins) the total system free memory drops drastically and reloads the app. At that point the WKWebView reloads itself; there is no console message, no crash log, nothing. At most I'll see an Xcode message about my device having "BKSProcessAssertion 'ConnectionTerminationWatchdog' initialized with invalid pid". The WKWebView has the markings of a memory leak and even if I remove the variables or objects their memory sticks around. Is there some way to release any memory it's holding in order to avoid reloads of the app?
Post not yet marked as solved
1 Replies
786 Views
[Assert] Failed to present a context menu for configuration with identifier 76F4D464-627B-4966-B90F-45D76EA6F285. This is likely due to a different presentation occuring during the lifecycle of the interaction. this project run in ios12 is ok. a new demo run in ios14 is ok. but this project run in ios14 is bad. url: h5apk.cn/input-capture.php WKWebViewConfiguration in ios14 change?
Posted
by
Post marked as solved
1 Replies
496 Views
This does not want to work at all with the new WK Web Kit but Will only work with the old UIWebKit I have tried a lot of new code but still doesn't wanna work at all. do {                     w.loadHTMLString(try NSString(contentsOfFile: Bundle.main.path(forResource: "index", ofType: "html")!, encoding: String.Encoding.utf8.rawValue) as String, baseURL: URL(fileURLWithPath: Bundle.main.bundlePath, isDirectory: true))                 } catch {                     // catch error                 }
Posted
by
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
Post not yet marked as solved
2 Replies
1.3k Views
When the touchstart event is added on the Document - on click of the dropdown the options box opens and closes immediately, thus restricting user to make any selections We are able to reproduce this issue on iOS14 : iPad 5th Generation, iOS 14.6 version with the code snippet below Note : The dropdown works fine when the touchstart event is disabled and this issue is specific to iOS14, works well on iOS13. <!DOCTYPE html> <html> <body onload="addEvents()"> <h1>The select element</h1> <p>The select element is used to create a drop-down list.</p> <form action="/action_page.php"> <label for="cars">Choose a car:</label> <select name="cars" id="cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option> </select> <br><br> <input type="submit" value="Submit"> </form> <p>Click the "Submit" button and the form-data will be sent to a page on the server called "action_page.php".</p> <script> function touchHandler(event) { var touches = event.changedTouches, first = touches[0], type = ""; switch (event.type) { case "touchstart": type = "mousedown"; break; case "touchmove": type = "mousemove"; break; case "touchend": type = "mouseup"; break; default: return; } if(document.getElementById("searchContainer") === null || document.getElementById("searchContainer").style.display === "none"){ var simulatedEvent = document.createEvent("MouseEvent"); simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null); first.target.dispatchEvent(simulatedEvent); //event.preventDefault(); } } function addEvents(){ document.addEventListener("touchstart", touchHandler, true); document.addEventListener("touchmove", touchHandler, true); document.addEventListener("touchend", touchHandler, true); document.addEventListener("touchcancel", touchHandler, true); } </script> </body> </html> As in this code snippet, onload we are adding touchstart event to the Document and the containing form has the dropdown. On click of the dropdown, we are unable to make selections as the dropdown options box gets closed immediately. Please assess this and let us know if this is a bug on your side and when the possible correction for this can be expected? Also, can you please update on the below ticket, The issue is still reproducible on the latest iOS version. This was accepted as a bug on your side - please share updates on this as well. https://developer.apple.com/forums/thread/671827?login=true&page=1#658436022
Posted
by
Post not yet marked as solved
4 Replies
1.7k Views
We call webView evaluateJavaScript:javaScript completionHandler:^(id _Nullable result, NSError *_Nullable error) API to inject a javascript to WKWebView. The javascript contains "window.***"definition. Since iOS 15, "window.***" can not be found and it will return "undefined" when accessing "window.***" . It seems that javascript "window" object can not have any custom sub-object. However same javascript code works fine on iOS 14.x and below. Any ideas? Thanks!
Posted
by
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
by
Post not yet marked as solved
0 Replies
375 Views
I´m using a WkWebView in my application. There is a page that shows a video recorder inside the web app. It works on iOS 14.4, but it doesn´t on 14.7.1. In that version, it is shown a modal to broadcast video, and it is shown completely black. If you close that modal, the video recorder works fine inside the web page. So, what I need is that modal doesn´t appears, as in iOS 14.4. In my log, I have seen the following lines: <CATransformLayer: 0x281391640> - changing property masksToBounds in transform-only layer, will have no effect <CATransformLayer: 0x281396100> - changing property allowsGroupBlending in transform-only layer, will have no effect
Posted
by
Post not yet marked as solved
0 Replies
419 Views
Hi, how can I fade out the background music (html5 audio element) of my browser game under iOS? Neither can I set audio.volume nor does it work to pipe it through the Web Audio API and modify the gain value. Both solutions work great on basically every non-Apple OS and browser. But it fails on Safari/OSX and in my experience on any browser under iOS. This is quite frustrating. So: how can I fade out music in my browser game under iOS? Thanks Leander
Posted
by
Post not yet marked as solved
1 Replies
897 Views
I'm using this js package  https://www.npmjs.com/package/idb to manage a simple indexedDB implementation on a web app. I'm using the excellent https://www.npmjs.com/package/idb package to manage a simple indexedDB implementation on a web app. I'm having this error "UnknownError: Database deleted by request of the user" reported to our error reporting system for a significant number of iOS users and I'm having trouble replicating. It seems to have so far only affect users on: Mobile Safari 14.6, 14.4.2, caught by try/catch Instagram webview, iOS 14.7.1 - not caught be try/catch I think the source of the error is this line in webkit https://github.com/WebKit/WebKit/blob/e98ff129bc8eba06ac17105f19c5f0e142aab853/Source/WebCore/Modules/indexeddb/shared/IDBError.h#L40 It seems to relate to the server connection closing. Can anyone help me understand what conditions are required to trigger this error so that I can replicate and try to handle in the app? A simplified version of the implementation: // ./store.js import { openDB } from 'idb' export const upgrade = (db) => { if (!db?.createObjectStore) return null db.createObjectStore('example_store_name_1') } export const set = async (storeName, val, key) => { const dbPromise = openDB('example_db_name', 1, { upgrade }) if (!window.indexedDB) return null return (await dbPromise).put(storeName, val, key) } export const count = async (storeName) => { const dbPromise = openDB('example_db_name', 1, { upgrade }) if (!window.indexedDB) return null return (await dbPromise).count(storeName) } // ./index.js import { set, count } from './store.js' export const storeEvent = async (storeName, value, key) => { try { const rowCount = await count(storeName) // I process and clear the db in a separate part of the app, this count is just here here as a rough limit to // ensure that I don't keep pushing data into storage if, for some reason, it is not getting cleared elsewhere if (rowCount < 500) { await set(storeName, value, key) } } catch (error) { // error reported to error monitoring tool } } Some of the things I have tried to replicate (on Instagram webveiw, iOS 14.7.1 or Mobile Safari 14.6): saving a massive object to idb and closing or backgrounding Instagram or Safari mid transaction saving a massive object to idb across multiple Safari tabs at the same time manually deleting idb db from Safari while transaction is in progress - seems to generate either "UnknownError: * Connection is closing." or "AbortError: The transaction was aborted, so the request cannot be fulfilled." - both caught by try/catch Safari incognito Setting Safari privacy to store no cookies (or any other form of browser storage) this transaction lifetime bug https://github.com/jakearchibald/idb#transaction-lifetime ... Google - nothing for this error other than the webkit source code. Any suggestions appreciated. I'd like to understand particularly how it is triggered in the iOS webview (Instagram) as these errors are not caught by try/catch currently.
Posted
by
Post not yet marked as solved
0 Replies
363 Views
Hello community, We noticed that the background video on our homepage is not playing when the iphone is in power save mode. A play icon appears but is not clickable. Same problem when we leave the page and come back to it with the "back" CTA of the browser. La vidéo est interrompu automatiquement. I am a total beginner in development (that's why we build our site with shopify 😅 ) Do you know how to fix this problem? Thanking you for your help 🙏 Best,
Posted
by
Post not yet marked as solved
1 Replies
1.9k Views
In our web app, we use the MQTT library which internally uses a WebSocket for communications. In iOS 14 and earlier it was working fine. But in iOS 15 and macOS Monterey, WebSocket breaks when we try to send the first message. Below are some findings from our research: There is an experimental feature named NSURLSession WebSocket in Safari. This feature is by default enabled on iOS 15 and macOS Monterey. If we disable this feature, WebSocket seems to work fine. We have also noticed that when the above-mentioned experimental feature is enabled, it seems to add some limit on the size of the message that we can send from a socket connection. If we try to send messages of more than 84 bytes, the socket connection breaks. If we try to send messages of fewer than 84 bytes it works fine.
Posted
by
Post not yet marked as solved
0 Replies
384 Views
Hi, I'm using MediaRecorder for screen recording of canvas , along with audio. simplified code to implement screen recorder //intialise stream const canvas = document.querySelector('.main-canvas'); const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); for (let track of canvas.captureStream().getTracks()) { stream.addTrack(track); } recorder = new MediaRecorder(stream); chunks = []; recorder.ondataavailable = ({ data }) => { if (data) chunks.push(data); }; recorder.start(); recorder.onstop = () => { const videoBlob = new Blob(chunks, { type: 'video/mp4' }); chunks = [] //stop mic access after use try{ for (let track of stream.getTracks()) { track?.stop(); } }catch(e){} return videoBlob; } so when i call recorder.stop() , the recorder.onstop method is not getting called sometimes randomly. And also in case when recorder.onstop is not called , recorder.ondataavailable is not called even a single time,So it returns empty Blob output. This only occurs in iOS 15 device's , it occurs randomly 40% of the times. Is there any workaround for this, or what is cause of this issue? Thanks in advance
Posted
by
Post marked as solved
2 Replies
458 Views
I want to put on 3D object on websites, but I don’t know how to do. It doesn’t explain AR such as Apple’s product page. It explain like top page’s earth of github.com. In short, I want to put 3D object without page-jumping. This question is maybe not adopted here -apple developer forum-, however I want someone to answer this.
Posted
by
Post not yet marked as solved
1 Replies
459 Views
Hello I have a webrtc-based web app that is loaded inside a WKWebView. The web app gets loaded just fine in our iOS App running WKWebView on an iPad with iOS 15.1. We are using the exact same app, built for Mac Catalyst. However, on the Mac version, the web app gets loaded but the RTCPeerConnection object is undefined.. Meaning that our web app assumes that WebRTC is not available in that browser. Isn't the native app supposed to work the exact same on iOS and MacOS? Is the Mac version of WKWebView more limited than its iOS counterpart ? Is there any resource that states exactly what is supported in WKWebview in each platform? Thanks
Posted
by
Post not yet marked as solved
0 Replies
635 Views
If you visit the website https://www.deutschlandfunk.de/ (or https://www.deutschlandfunkkultur.de/) with Safari and browse for a while inside that domain (duration is not fixed neither the amount of visited pages), images are not loaded any more (unless they are already in cache). It seems to be necessairy to use the back button while browsing to trigger that behaviour. This issue occurs using the Safari browser on Mac as well as on IPhones and IPads. On iOS it affects Firefox and Chrome too. As soon as the issue occurs, any new image (e.g. image is not in cache storage) will not be shown. "A while" can be a few hours. We were not able to find out any event that might be causing this issue. Cached Images will be shown. Using the inspector you can see, that the browser tries to load the images, but nothing happens. There is no error or warning. It seems, that the request is not fired at all. Copying the URL of an unloaded image to another browser tab does not load the image neither. Using another browser (on Mac system) loads the image in the other browser. The issue is reproduceable using the incognito/private mode too. It seems to be related to the browser session. It works in a newly opened window in private mode or after closing and reopening the browser again, as well in other browsers or with curl on the command line. It is not related to JavaScript, we disabled JavaScript in Safari and the issue was still reproducible. Once the browser is in this state, there is no way to load any images from nor do any requests (even for non existent resources) to assets.deutschlandfunk.de or assets.deuschlandfunkkultur.de until restarting it. Clearing cache, cookies does not help, even after a waking the system up after a few days in sleep mode does not change anything Thank you!
Posted
by