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

WebKit Documentation

Posts under WebKit tag

283 Posts
Sort by:
Post not yet marked as solved
1 Replies
299 Views
--> autocorrect changes D66 into D'66 incorrectly on all Dutch devicesThe political brand name should not bet corrected into D'66.How do i get through to the devolopers of autocorrect?
Posted
by
Post not yet marked as solved
2 Replies
2.6k Views
I've met this problem when scrolling on my iPhone 6 device (iOS version 11.2.6). I've tested it on Safari and Chrome.Given a scrollable div, if i touch it when already on momentum scrolling motion, the scrolling stops as expected but the touchstart event is not triggered. If i touch (scrolling stops) and slide the finger, touchmove events does not trigger also.I need to touch (scrolling stops), raise the finger and then touch again to "reactivate" the touchstart/touchmove events.When tested on Xiaomi Android device (on Chrome), if i touch (scrolling stops) and slide the finger then touchstart/touchmove events are triggered.Is this issue a standard behaviour on iPhone?.I have set up a fiddle to test this behaviour:https://fiddle.jshell.net/galoxia/L63wj9or/Just flick to "activate" momentum scrolling on the blue box and then touch again to stop it. On Android you will see touchstart in the yellow box. On iPhone you will not.
Posted
by
Post not yet marked as solved
19 Replies
15k Views
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?
Posted
by
Post not yet marked as solved
2 Replies
981 Views
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?
Posted
by
Post not yet marked as solved
7 Replies
5.1k Views
I am using WKWebview in my application to load a third party banking provider page. Once the details are entered the suer makes a form submit to post the contents to teh server. But in WKWebview the post information is completely stripped off. Is this a bug in WKWebview or am I missing something in the implementation? The http post body is always nil when I inspect inside the decidePolicyForNavigationAction delegate.I have seen similar issues reported by others. One suggestion is to create a mutable copy of the request and append your post data inside the WKWebview decide policy delegate. But this is not an option for me as I am dealing with third part web pages?Is there any solution for this issue?Thanks.
Posted
by
Post not yet marked as solved
3 Replies
1.7k Views
Apple docs for WKWebView state: "The process pool associated with a web view is specified by its web view configuration. Each web view is given its own Web Content process until an implementation-defined process limit is reached; after that, web views with the same process pool end up sharing Web Content processes."I can see something called maximumProcessCount for the processPool property when I NSLog the description for WKWebView, but I can't find any way to control the process limit, as described by Apple above.I need to do this, because my (MacOS/Objective-C) app can have a large number of WKWebViews at times, and the huge number of processes spawned by all of them brings the system to its knees.Thanks in advance for any help!
Posted
by
Post not yet marked as solved
1 Replies
1.9k Views
Hi,I am having this error in iphone . I am not able to figure out where it is coming from. I have not taken any such variable in my code.I have seen this error mentioned in stackoverflow and others but no answer there.I see this error is coming in iphone only . SpecficationUser Agent: ========================================================================================== Browser = WebKit Browser Version = 605.1.15 Mobile = mobile Apple iPhone OS = iOS OS Version = 11.4 Cookies = true Screen = 375 x 667This error is also coming in OS version 11.4 , 11. 3 , 10.3. Can you tell me is this is error is iphone safari , ios specific ? Does it effect client ?Thanks
Posted
by
Post marked as solved
6 Replies
25k Views
Hello forum!I have a special problem with my iOS App.My setup is the following:Swift 4 app with minimum target iOS 11the app consists more or less of single view with a WKWebView which is connected to the client portal of a health insurancethe client portal provides a login (session cookies) and allows to download pdf documents when logged-inI want the downloades pdf files to be opened in QuickLookPreviewController instead of WKWebView.The customer need is that they want to be able to print or share their documents and I like to use the QuickLookPreview therefore, because it offers the best native feeling for this case.Now to my problem:I managed to download the documents to local storage (temp folder) and to open it in QuickLookPreviewController with a little trick:The response of the download is intercepted (by using webView(..., decidePolicyFor ...)) and the download url is used to trigger a separate download (using URLSession.shared.dataTask(with: downloadUrl)) to iPhone storage, because QuickLookPreviewController needs a local file and cannot deal with the download url to the pdf.In general this works - most of the time. Since I need to be in a logged-in state to download the pdf, I have to pass the authentication cookies from WKWebView (where I logged-in) to the shared cookie storage (which is used by the download task). This cookie sync between the two cookie storages is a known issue and I think I read all the related postings in the web, but couldn't get it working reliably.In my debug logs I can see that my logic works in general, but sometimes the cookies aren't synchronized at all.Here's my code. I appreciate every help 🙂 import UIKit import WebKit import QuickLook class ViewController: UIViewController, WKUIDelegate, WKNavigationDelegate, QLPreviewControllerDataSource { @IBOutlet var webView: WKWebView! var documentPreviewController = QLPreviewController() var documentUrl = URL(fileURLWithPath: "") var webViewCookieStore: WKHTTPCookieStore! let webViewConfiguration = WKWebViewConfiguration() ... override func viewDidLoad() { super.viewDidLoad() // link the appDelegate to be able to receive the deviceToken let appDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.viewController = self // initial configuration of custom JavaScripts webViewConfiguration.userContentController = userContentController // QuickLook document preview documentPreviewController.dataSource = self webView = WKWebView(frame: CGRect.zero, configuration: webViewConfiguration) // see "The 2 delegates": https://samwize.com/2016/06/08/complete-guide-to-implementing-wkwebview/ webView.uiDelegate = self webView.navigationDelegate = self view.addSubview(webView) webViewCookieStore = webView.configuration.websiteDataStore.httpCookieStore ... load("https://clientportal.xyz"!) } private func load(_ url: URL) { load(URLRequest(url:url)) } private func load(_ req: URLRequest) { var request = req request.setValue(self.deviceToken, forHTTPHeaderField: "iosDeviceToken") request.setValue(self.myVersion as? String, forHTTPHeaderField: "iosVersion") request.setValue(self.myBuild as? String, forHTTPHeaderField: "iosBuild") request.setValue(UIDevice.current.modelName, forHTTPHeaderField: "iosModelName") debugPrintHeaderFields(of: request, withMessage: "Loading request") webView.load(request) debugPrint("Loaded request=\(request.url?.absoluteString ?? "n/a")") } /* Intercept decision handling to be able to present documents in QuickLook preview Needs to be intercepted here, because I need the suggestedFilename for download */ func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { let url = navigationResponse.response.url if (openInDocumentPreview(url!)) { let documentUrl = url?.appendingPathComponent(navigationResponse.response.suggestedFilename!) loadAndDisplayDocumentFrom(url: documentUrl!) decisionHandler(.cancel) } else { decisionHandler(.allow) } } /* Download the file from the given url and store it locally in the app's temp folder. The stored file is then opened using QuickLook preview. */ private func loadAndDisplayDocumentFrom(url downloadUrl : URL) { let localFileURL = FileManager.default.temporaryDirectory.appendingPathComponent(downloadUrl.lastPathComponent) // getAllCookies needs to be called in main thread??? (https://medium.com/appssemble/wkwebview-and-wkcookiestore-in-ios-11-5b423e0829f8) //??? needed?? DispatchQueue.main.async { self.webViewCookieStore.getAllCookies { (cookies) in for cookie in cookies { if cookie.domain.range(of: "my.domain.xyz") != nil { HTTPCookieStorage.shared.setCookie(cookie) debugPrint("Sync cookie [\(cookie.domain)] \(cookie.name)=\(cookie.value)") } else { debugPrint("Skip cookie [\(cookie.domain)] \(cookie.name)=\(cookie.value)") } } debugPrint("FINISHED COOKIE SYNC") debugPrint("Downloading document from url=\(downloadUrl.absoluteString)") URLSession.shared.dataTask(with: downloadUrl) { data, response, err in guard let data = data, err == nil else { debugPrint("Error while downloading document from url=\(downloadUrl.absoluteString): \(err.debugDescription)") return } if let httpResponse = response as? HTTPURLResponse { debugPrint("Download http status=\(httpResponse.statusCode)") } // write the downloaded data to a temporary folder do { try data.write(to: localFileURL, options: .atomic) // atomic option overwrites it if needed debugPrint("Stored document from url=\(downloadUrl.absoluteString) in folder=\(localFileURL.absoluteString)") DispatchQueue.main.async { self.documentUrl = localFileURL self.documentPreviewController.refreshCurrentPreviewItem() self.present(self.documentPreviewController, animated: true, completion: nil) } } catch { debugPrint(error) return } }.resume() } } func previewController(_ controller: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { return documentUrl as QLPreviewItem } /* We always have just one preview item */ func numberOfPreviewItems(in controller: QLPreviewController) -> Int { return 1 } /* Checks if the given url points to a document provided by Vaadin FileDownloader and returns 'true' if yes */ private func openInDocumentPreview(_ url : URL) -> Bool { return url.absoluteString.contains("/APP/connector") } P.S. I tried many solutions:Reading and syncing the cookies in main thread (there are many hints in the web, that you have to acces cookies in this way) - does not work reliablyReading the WKWebViews cookies via Javascript to avoid the main thread handling - but here I get too less information about the cookies (e.g. domain and path is missing)I configured a WKProcessPool - didn't helpMost of the time the cookies are synchronized, but with the same implementation I get problems when trying it later on, e.g. when I uploaded the presumably working code to TestFlight. It even differs when using a solution in Simulator or on a real device.The error is a downloaded file (HTTP status 200), but its size is less than 8 kB, because I wasn't allowed to download it it because of the missing synchronized authentication cookie.
Posted
by
Post not yet marked as solved
1 Replies
2.6k Views
I can debug WKwebview's js content with Safari inspector when I run the project into a real device, but Safari can't find any inspectable appliction when I try to debug the archived app that has been set to be debug. By the Way, I have set the deivce's Web inspector enable.
Posted
by
Post not yet marked as solved
12 Replies
5.5k Views
I'm using WKWebview to present website, but I recently get many crash info in iOS 12 from fabirc, is any clue to solve this issue?Crashed: com.apple.main-thread 0 WebKit 0x21be87594 WebKit::WebPageProxy::resetStateAfterProcessExited(WebKit::ProcessTerminationReason) + 720 1 WebKit 0x21be8758c WebKit::WebPageProxy::resetStateAfterProcessExited(WebKit::ProcessTerminationReason) + 712 2 WebKit 0x21be7b468 WebKit::WebPageProxy::processDidTerminate(WebKit::ProcessTerminationReason) + 604 3 WebKit 0x21bf07ab8 WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch() + 736 4 WebKit 0x21bf077a8 WebKit::WebProcessProxy::didClose(IPC::Connection&) + 160 5 JavaScriptCore 0x2135e10f0 ***::RunLoop::performWork() + 276 6 JavaScriptCore 0x2135e13b8 ***::RunLoop::performWork(void*) + 36 7 CoreFoundation 0x20c29e5b8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 8 CoreFoundation 0x20c29e538 __CFRunLoopDoSource0 + 88 9 CoreFoundation 0x20c29de1c __CFRunLoopDoSources0 + 176 10 CoreFoundation 0x20c298ce8 __CFRunLoopRun + 1040 11 CoreFoundation 0x20c2985b8 CFRunLoopRunSpecific + 436 12 GraphicsServices 0x20e50c584 GSEventRunModal + 100 13 UIKitCore 0x238b93558 UIApplicationMain + 212 14 MyAppXXXxx 0x1009aaa68 main (main.m:15) 15 libdyld.dylib 0x20bd58b94 start + 4
Posted
by
Post not yet marked as solved
1 Replies
5.1k Views
I'm currently working on a web application which sits inside an iframe for security purposes (protecting user data) and is hosted on other websites. To keep session state for insecure data, we write some data to local storage for user functionality i.e., remembering the user's background colour we save "backgroundColour" as "red".However I have run into the following two issues on iOS Safari which currently work on MacOS Safari and Chrome and internet Explorer 11.---Issue 1: local storage is not retained when I force quit iOS:The user navigates to the host website, www.host.com, which loads my iframe content from a different domain, www.example.comThe user then interacts with the iframe and saves their background colour preferences which I save to local storage.The user then force quits Safari or navigates away and then force quits Safari.Navigate back to the host websiteExpected behaviour: The localStorage contains the backgroundColour propertyActual behaviour: The local storage is empty---Issue 2: using the iframe content on different sites doesn't utilise local storageThe user navigates to the host website, www.host.com, which loads my iframe content from a different domain, www.example.comThe user then interacts with the iframe and saves their background colour preferences which I save to local storage.The user navigates to www.awesomesite.com which also has my iframe content from the domain in step 1, www.example.comExpected behaviour: The local storage is retained between the different sites because the storage is against DNS of the iframeActual behaviour: The local storage is empty---Note: we are not looking at using Cookies.Has anyone experienced this before? Are there any workarounds that people have found? Is this a bug in iOS Safari? Have I done something wrong?Cheers
Posted
by
Post not yet marked as solved
1 Replies
1.2k Views
We are developing a website which is exchanging cross site cookies. Since, the default settings for safari is to prevent the cross site tracking, the cookie is not passed in the calls, impacting the further functionalities.Is there any way to detect the current safari cookie settings using Javascript?
Posted
by
Post not yet marked as solved
4 Replies
16k Views
I'm using WKWebView to display help content in an app. It's embedded in a view that's displayed by a view controller when required, and the help content is extracted from the app's main bundle and loaded via loadHTMLString. This all works without a problem, but exactly 30 seconds after navigating away from the help view two messages appear on the log:Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified serviceCould not signal service com.apple.WebKit.Networking: 113: Could not find specified serviceI've confirmed that the view controller and view containing the WKWebView have been deallocated as expected when navigating away from the help view, so I'm unsure what could be remaining active to cause these messages, especially given all the content displayed is local to the app.
Posted
by
Post not yet marked as solved
1 Replies
3k Views
In the latest IOS12 system, Total canvas memory use exceeds the maximum limit (224 MB), which causes the drawing to fail! Total canvas memory use exceeds the maximum limit (224 MB) using safari debugging. However, this problem does not occur before iOS12. How can I solve it?
Posted
by
Post not yet marked as solved
3 Replies
1.9k Views
Our iOS application was using UIWebView to load a sign in page and password autpfill(There's a bar above the keyboard with two suggested accounts and a "key icon") works fine with that. After we migrate to WKWebView, the "Key icon" still works and passwords will be filled in with no issue after I select any of the stored accounts. But if I choose any of the two suggested accounts, nothing happens and the password will not be filled in. All my testing was done on iOS 12 device.There's no change on our HTML sign in page and it still works with UIWebView. For our use case, I think our iOS native code is basically off the hook and it's iOS dealling with the HTML page for giving the suggestion and filling on passwords. Since there's no change from the sign in page, is this a WKWebView bug, or did we miss anything when initiating the WKWebView?
Posted
by
Post not yet marked as solved
81 Replies
65k Views
Hi,Progressive Web Apps is a trend in 2019 and web push notifications for iOS are not supported right now.Do you have a date for the web push support?Thanks
Posted
by
Post not yet marked as solved
1 Replies
1.2k Views
We are able to access camera and perform QR code scanning in Safari browser. But the same website when we convert to PWA app we are not able to do the same.Could you please help me in resolving the issue in PWA app.
Posted
by
Post not yet marked as solved
3 Replies
3.9k Views
I generated an XML String in JavaScript and I need to download it as a file. I tried both answers provided in here.Answer 1Answer 2Both answers work perfectly fine on MacOS Safari, iOS Safari and Raspbian Chromium, but when I try to download within the PWA on the iPad iOS 12.1.4, it does simply nothing. No Errors in console either.If I try downloading in a new tab, it just shows a white screen and nothing happens.
Posted
by
Post not yet marked as solved
1 Replies
977 Views
i have the demand to use JSContext run the JavaScript with WebAssembly, but JSContext not support.i test this on the iOS12.4, iPhone6slet script = """ (()=>{ function testSafariWebAssemblyBug() { var bin = new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]); var mod = new WebAssembly.Module(bin); var inst = new WebAssembly.Instance(mod, {}); // test storing to and loading from a non-zero location via a parameter. // Safari on iOS 11.2.5 returns 0 unexpectedly at non-zero locations // console.log(inst.exports.test(4)); return (inst.exports.test(4) !== 0); } if (testSafariWebAssemblyBug()) { // ok, we stored a value. return 'ok'; } else { return 'fail'; } })(); """ var context = JSContext( context?.exceptionHandler = { [weak self] _, error in if let error = error { let message = String(describing: error) print(message) } } let value = context?.evaluateScript(script) if let value = value { let message = String(describing: value) print(message) }the console printOut of executable memory in function at index 0 (evaluating 'new WebAssembly.Instance(mod, {})')
Posted
by