wkwebview

Getting the link URL tapped in WKWebView

♀尐吖头ヾ 提交于 2020-08-04 04:29:57
问题 I want to get the url of a tapped link in WKWebView . The links are in a custom format that will trigger certain actions in the app. e.g. http://my-site/help#deeplink-intercom . I am using KVO like so: override func loadView() { let webConfiguration = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.navigationDelegate = self webView.addObserver(self, forKeyPath: "URL", options: .new, context: nil) view = webView } override func observeValue

WKWebView goes blank after memory warning

牧云@^-^@ 提交于 2020-08-02 06:41:30
问题 I'm developing an iOS app that will show some 360 panoramic content in a wkWebView. The page does load, but when it receives a memory warning, it shows a blank view on iPad 2. Relevant code: NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://360yerevan.com/mobilembed/91001/"] ]; NSString *jScript = @"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName(

WKWebView gives BLANK navigationAction.request for SOME links with target=blank

此生再无相见时 提交于 2020-07-22 22:24:17
问题 With reference to This question for how to load links with blank target in WebView, I tried the given solution : func webView(_ webView: WKWebView!, createWebViewWith configuration: WKWebViewConfiguration!, for navigationAction: WKNavigationAction!, windowFeatures: WKWindowFeatures!) -> WKWebView! { if navigationAction.targetFrame == nil { //This request is blank here webView.load(navigationAction.request) } return nil } Still as mentioned by Jason Murray in comments, When I click on a link

WKWebView gives BLANK navigationAction.request for SOME links with target=blank

我的梦境 提交于 2020-07-22 22:15:03
问题 With reference to This question for how to load links with blank target in WebView, I tried the given solution : func webView(_ webView: WKWebView!, createWebViewWith configuration: WKWebViewConfiguration!, for navigationAction: WKNavigationAction!, windowFeatures: WKWindowFeatures!) -> WKWebView! { if navigationAction.targetFrame == nil { //This request is blank here webView.load(navigationAction.request) } return nil } Still as mentioned by Jason Murray in comments, When I click on a link

WKWebView gives BLANK navigationAction.request for SOME links with target=blank

做~自己de王妃 提交于 2020-07-22 22:13:45
问题 With reference to This question for how to load links with blank target in WebView, I tried the given solution : func webView(_ webView: WKWebView!, createWebViewWith configuration: WKWebViewConfiguration!, for navigationAction: WKNavigationAction!, windowFeatures: WKWindowFeatures!) -> WKWebView! { if navigationAction.targetFrame == nil { //This request is blank here webView.load(navigationAction.request) } return nil } Still as mentioned by Jason Murray in comments, When I click on a link

How do I make WKWebView's height fit its contents in Xamarin with a CustomWebViewRenderer?

℡╲_俬逩灬. 提交于 2020-07-22 00:55:00
问题 I've made a Custom webview renderer for iOS where I manually replace a custom WebView with a WKWebView. However, my main purpose is to make the WKWebView adjust it's height according to it's contents. It's contents consist of predefined HTML string with body. Right now it cuts the Webview off and the rest of the content is crammed up in a scrollview. The images and text that I put before the webview also stay fixed in place, while I want them to scroll down too. I do not want a scrollbar for

How do I make WKWebView's height fit its contents in Xamarin with a CustomWebViewRenderer?

只谈情不闲聊 提交于 2020-07-22 00:51:34
问题 I've made a Custom webview renderer for iOS where I manually replace a custom WebView with a WKWebView. However, my main purpose is to make the WKWebView adjust it's height according to it's contents. It's contents consist of predefined HTML string with body. Right now it cuts the Webview off and the rest of the content is crammed up in a scrollview. The images and text that I put before the webview also stay fixed in place, while I want them to scroll down too. I do not want a scrollbar for

How do I make WKWebView's height fit its contents in Xamarin with a CustomWebViewRenderer?

自古美人都是妖i 提交于 2020-07-22 00:50:33
问题 I've made a Custom webview renderer for iOS where I manually replace a custom WebView with a WKWebView. However, my main purpose is to make the WKWebView adjust it's height according to it's contents. It's contents consist of predefined HTML string with body. Right now it cuts the Webview off and the rest of the content is crammed up in a scrollview. The images and text that I put before the webview also stay fixed in place, while I want them to scroll down too. I do not want a scrollbar for

How to detect hash changes in WKWebView?

走远了吗. 提交于 2020-07-21 02:38:28
问题 I have a website that uses javascript that uses angular to control what you see on the website. So http://somewebsite.com/#page1 is shown and when you click on a tab that location changes to http://somewebsite.com/#page2. There will be no actual reload on the website and therefor func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) will not get triggered. How can you catch these hash changes? Clearly Apple can, since the Safari webbrowser is able to show these changes in

WkWebView Evaluatejavascript returns unsupported type error

一个人想着一个人 提交于 2020-07-18 04:33:48
问题 I'm sending a value to javascript function and get a result. However, I'm getting "Error Domain=WKErrorDomain Code=5 "JavaScript execution returned a result of an unsupported type" UserInfo={NSLocalizedDescription=JavaScript execution returned a result of an unsupported type}" error when run below code; webView?.evaluateJavaScript("getURL()") { (result, error) in if let error = error { print("\(error)"); return } if let song = result as? String { print("\(song)"); } } and javascript code as