Display web content in windows and implement browser features using WebKit.

Posts under WebKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Pass parameters in AppStore from webpage
Hello everyone,For my first post, i would like to know if it is possible to pass a specific parameter from a link in an html page to the appstore and retrieve it directly in the app? From my search it's quite complicate and there isn't any easy way to do it. Am I right or it is possible?
2
0
3.2k
Sep ’23
background-attachment:fixed still not supported?
Every now and then I need to make a website. And I noted in my last project that background-attachment:fixed; is still not supported by iOS. It is by Safari on MacBooks, so I'm wondering what the story behind it is? Surely it is not a matter of computational cost due to the so-called repainting of the browser's canvas? Because doesn't playing video cost a multitude of that?
30
5
30k
Sep ’23
Visa test card is "Not accepted by this website"
I'm trying to test payments with different card types on the website.I've added test cards fromhttps://developer.apple.com/support/apple-pay-sandbox/to my tester account.In my payment request I added supportedNetworks:supportedNetworks: ["amex", "masterCard", "visa", "discover"],Payments work fine with amex, mastercard and discover, but Visa cards are not selectable, with the reason "Not accepted by this website".Are there some other requirements to use visa cards on the website?
4
0
2.5k
Aug ’23
Use a HTTP Proxy with WkWebView
Hi,We have a need in our Swift app for using a HTTP proxy with WKWebView. We want to route all HTTP(S) traffic through a proxy running Privoxy, which strips the http(s) traffic of tracking scripts and ads (for HTTPS traffic we obviously cannot see the content and strip the ads, but we can still block the requests going to hostnames that are known for serving ads). That is basically our product to our costumers. Anonymous (through proxy), ad and tracking free browsing, where no one is monitoring what you are buying or browsing with the purpose of profiling you and selling the information about you to others.With the now deprecated UIWebview, we were able to setup a HTTP proxy through the NSUrlProtocol, but since its deprecated now, continouing using it seems like a risky idea in anything but the short term.We have not found any way, by which we can setup a HTTP proxy in the WKWebView, since it seems to be doing the networking out-of-process of the app... Sources like this post on this forum seems to back this up: https://forums.developer.apple.com/thread/74572.However, Ssome sources seems to indicate that WkWebView was made more user-friendly with IOS 11 and IOS 12 - which is after the above post, so maybe it is possible now. As said, we have tried without luck recently, but maybe we are missing something?We hope someone can help or otherwise just give us some clarity, as the core part of our product depends on this feature, so any help and/or clarity is appreciated.NB:We have considered other options such as using a VPN to send all our data through our own servers. This requires that we change our full infrastructure setup though. And it seems that there is no split-tunneling options in IOS (on non-managed IOS), so if we use the VPN approach, our VPN connection (meant just for some casual browser surfing) will become a general VPN connection on the device. That means we would have to carry the full load of the users' network usage suddenly, which would likely force us to triple our monthly subscription fee to be rentable...Hope to get an answer, and sorry for the slightly long post! (Hopefully it showed we have done our homework and are not asking you to do it for us atleast!).Best,Jonas
13
0
12k
Oct ’23
Safari passwords on subdomains
When I login to an account on a subdomain of a main domain, I want to be able to store a separate password for the same login id on the main domain account. This doesn't seem possible in the current Safari implementation.eg: domain.com is the main domain and is the general information site.my.domain.com is the subdomain that hosts the customer support.I want different passwords on each for the same login ID... Can't I do this?--marcel
22
10
8.9k
Oct ’23
height:100% is not 100% after rotating device
I've observed some strange behavior that started around iOS 12.2 and continues through iOS 13.x. If you load even a very simple web page into Safari that contains a div with a 100% height, then the result is correct and you get a full-screen div. If you rotate the device to landscape then it resizes and the div still fills the screen. But when you rotate it back to portrait, an empty white area appears at the bottom of the screen, and there doesn't appear to be a way to make it go away.I suspect this has to do with the change Apple made around the iOS 12.2 timeframe, where when a phone is rotated to portrait, the URL bar shrinks and the navigation bar is hidden. When this happens, the content area is in effect larger than it was before, but it's like CSS doesn't know about it, so a height of 100% represents the height as if the URL bar was larger and the nav bar was present.This HTML is enough to show the issue:<!DOCTYPE html> <html style="margin:0; padding:0; height:100%;"> <head> <title>Test Page!</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body style="margin:0; padding:0; height:100%;"> <div id="Layout1" style="border-width:0px; height:100%; width:100%; background-color:red;">Rotate me</div> </body> </html>Viewing that page on an iPhone with iOS 12.2+ will look fine, so rotate to landscape and then rotate back to portrait. A white area will appear at the bottom. I'm told that on larger-style iPhones, this only occurs if it is the only tab open -- otherwise, iOS never hides the navigation bar. On my 6s, it happens every time.Has anybody seen this before? Any ideas for working around it? It is making all of our web apps "scrunch up" after users rotate their devices, with no obvious way to programmatically fix it!Thanks!
6
0
11k
Aug ’23
WKWebView memory budget
What exactly is the memory budget of the WKWebView and is it possible to increase the amount of memory it can consume? I am finding that when I attempt to load a large WebGL scene into the WKWebView I am getting the webViewWebContentProcessDidTerminate callback and unable to load my scene. Is it possible to keep the WebContent process from quitting?
4
0
2.4k
Sep ’23
WKWebView password autofill
Hi, We've been using the WKWebView for authentication and authorization purposes inside our app. Unfortunately, we are not able to enable the password autofill/keychain integration with WKWebView. The website is working correctly (we can see the suggested passwords and the key for the password list)whenever we are opening it using Safari, but when we are trying to open it inside our app using the WKWebView there is only default toolbar ( with arrows and done button). Is there a possibility to enable autofill using some javascript scripts or WKWebViewConfiguration in WKWebView or is this behaviour is reserved only for SFSafariViewController and Safari?
9
1
8.5k
Aug ’23
Change volume of YouTube video playing in WKWebView
We are creating a watch party app that allows you to video chat with your friends and play a YouTube video at the same time. The video is played using Google's youtube-ios-player-helperlibrary which uses a WKWebView with their iframe API, as that's the only way to play it without violating the Terms of Service. We need the ability to change the volume of the YouTube video separately from the video chat, so you can hear your friends over the video for example. Unfortunately it's not possible to directly change the volume because iOS does not support changing the volume via JavaScript - https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html#//apple_ref/doc/uid/TP40009523-CH5-SW10, unlike macOS. Setting volume doesn't do anything and getting it always returns 1. Users can change the volume with the hardware buttons but this applies to all audio including the video chat, not just the YouTube video. Someone found a workaround - https://stackoverflow.com/a/37315071/1795356 to get the underlying AVPlayer and change its volume natively. This worked with UIWebView but does not work now that it uses WKWebView. What can be done to change the volume of the YouTube video?
1
0
1.6k
Sep ’23
How to prevent WKWebView open instagram app automatically?
I have been struggling to prevent WkWebView open Instagram app automatically when a user clicked a hyperlink on WKWebView. Currently, my app is able to open the new window/new tab request from my web app and load into a new ViewController which creating another WKWebView to handle the request. However, whenever I clicked the link which is opening the user's Instagram profile, iPhone will automatically open the installed Instagram app. I have tried a few approaches and it is still not working as expected. I have another social media app which is Facebook and it is working as expected because it doesn't open the installed Facebook app on my phone and able to load into the new ViewController. Scenario 1: Although able to open a new tab, but the entire webview has stopped working. Scenario 2: Unlimited loop due to will always trigger the decidePolicyFor function. Scenario 3: Delete installed Instagram app, It wouldn't open the app automatically and able to load into the local WkWebView but this is not the solution. Thank you in advance and sorry if I didn't provide a clear description. func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { 		if let host = navigationAction.request.url?.host { 			 if host == "www.instagram.com" { 							 								/* Scenario 2, unlimited loop */ 								if let url = navigationAction.request.url { 										let request = URLRequest(url: url) 										self.webView.load(request) 								} 								 								/* Scenario 1, prevent loading user's instagram profile in local wkwebview */ 								decisionHandler(.cancel) 								return 						} 				} 	 decisionHandler(.allow) }
3
0
2.7k
Sep ’23
iOS 14.x Custom Font Issue
We are having the below weird issue on 14.x devices Issue :    My application is a hybrid application. We have noticed an issue on 14.x related to loading the fonts mentioned in our CSS. The font file is not getting loaded occasionally. We couldn't infer much what is hindering the font loading on 14.x. In the previous version of iOS, this just works fine.   CSS:   @font-face{  font-family: "custom-font";src: url("fonts/custom-font.woff2")format("woff2"),  url("fonts/custom-font.woff")format("woff"),  url("fonts/custom-font.ttf")format("truetype") }     The above style sheet is linked to the page that we are loading.   Has anyone observed this issue on your project ? If so, please let us know the approach followed to resolve the same.     We also tried to follow the approach where the font file is loaded by native portion. The below approach works fine on iPhone Simulator but not on device, no clue why it's so   Added the font to the App and the file is targeted properly (Fonts provided by application key is updated). Ensure that the specific font is loaded and available using logs Used the font family in our CSS (we don't have to load the font on WkWebView space)
10
1
8.6k
Sep ’23
MediaRecorder onstop callback doesn't get called in iOS15
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
6
2
2.3k
Oct ’23
WebKit Error Does someone knows it?
I continually receive this error when using AdMob Banners (swift 5, on iOS simulator and devices using Xcode 13.5) it seems something related to Webkit, this continuous exception slows my app and continually produce network calls [ProcessSuspension] 0x10c240f60 - ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=94309, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
8
0
6.3k
Oct ’23
RTCPeerConnection is undefined on page loaded in Mac WKwebview
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
2
0
1.5k
Aug ’23
wkWebView, Trusted Domain, and Autofill/KeyChain Issue
We have been searching for almost one year for answers as to why wkWebView using an Entitled Domain will allow Autofill with KeyChain to fill credentials, but will not trigger Autofill to store/save them. In other words, if users have previously stored credentials in Safari while visiting domain X, subsequent visited to wkWebView with entitled domain X will allow use of those credentials in wkWebView through the Autofill/Keychain dialogue. However, users cannot save/store credentials within wkWebView in Trusted domain X because the save dialogue is never triggered.
3
0
2.0k
Sep ’23
WKWebView evaluateJavascript method crash with async/await when javascript call doesn't have return value
I wrote a code like the example below to execute javascript code that has no return value. let webView: WKWebView // after load complete let result = await webView.evaluateJavascript("someFunction()") // :0: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value but when i use method with completion handler manner, it doesn't be crashed. but Xcode enforces me to use 'await' keyword and warning is bordering me await webView.evaluateJavaScript("someFunction()", completionHandler: nil) // warning: Consider using asynchronous alternative function The differnce I found is the different signature. Completion handler version has Optional result type, but async/await version has just Any result type func evaluateJavaScript(_ javaScriptString: String, completionHandler: ((Any?, Error?) -> Void)? = nil) func evaluateJavaScript(_ javaScriptString: String) async throws -> Any my Xcode version is 13.2.1. Hope to fix it soon.
7
10
3.4k
Oct ’23
WebView force close inappbrowser
I have a function where user can open webpage in inappbrowser and make payment there. I get this error as below when user want to make payment. My apps have no issue when launch webpage, but when user click to pay and payment gateway call selected bank url, inappbrowser suddenly closed. android is working fine but having problem only in ios. I already update webview to latest version and enable ATS.. but didnt working at all. this is a critical bugs since my users unable to make payments for now. Please help me. thank you Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} ProcessAssertion: Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=5315, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=5315, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
3
0
1.1k
Aug ’23