wkwebview

Capture redirect url in wkwebview in ios

穿精又带淫゛_ 提交于 2020-05-07 11:24:09
问题 How do I capture the redirection url in when using WKWebView like if a webpage redirects to another page on submitting the username and password or some other data. I need to capture the redirected url. Is there any method in WKNavigationDelegate to override? 回答1: Use this WKNavigationDelegate method public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Swift.Void) { if(navigationAction

Multiple WKwebkit views in a single view controller not working

拟墨画扇 提交于 2020-04-30 11:03:29
问题 I am not able to load my sub views. I define them as weak WKWebKit outlets. if i do view = tickerView or view = graphView , it works, but it only loads one of them. I want to load both. How would i do this? override func loadView() { tickerView = WKWebView() tickerView.navigationDelegate = self self.view.addSubview(tickerView) graphView = WKWebView() graphView.navigationDelegate = self self.view.addSubview(graphView) } 回答1: Don't add as subView if you are already connect outlet webView as

Manipulate paste content in WKWebView

微笑、不失礼 提交于 2020-04-18 05:47:28
问题 I need to manipulate the text that is pasted into a WKWebView (from any source) running an asynchronous operation that can take some time. My original idea was to use Javascript and the WKWebView configuration in order to get the onpaste event: WKUserContentController *wkUController = [[WKUserContentController alloc] init]; NSString *pasteJSSource = @"document.addEventListener('onpaste', function(){ window.webkit.messageHandlers.ComposerListener.postMessage('onpaste happened!'); })";

How to use RegExp in React-Native Webview's injectedJavaScript prop?

眉间皱痕 提交于 2020-04-18 05:42:32
问题 When I use regexp in React-Native-Webview's injectedJavaScript prop, an error Unterminated regular expression literal error will be thrown and the regexp will not be honored. How should I use regexp in injectedJavaScript? If not, is there a workaround I can use? Minimal reproducible code is below: // this won't work <WebView source={{ uri: 'https://github.com/ashi009/node-fast-html-parser' }} injectedJavaScript={`const regE = /\n|\r/`} /> // this won't work as well <WebView source={{ uri:

WKWebView does not trigger method createWebViewWithConfiguration

假如想象 提交于 2020-04-17 18:30:49
问题 I'm trying to run Javascript within in a HTML Source. The code inside is suppose to open a new window with another HTML Source I given. What's my mistake here? ( My goal is to prove the WKWebView has ability in opening nested popup window) Meaning that, Webview opened a PopUpWindow A , then PopUpWindow A will window.open() PopUpWindow B , then PopUpWindow B will window.open() PopUpWindow C . In my WKWebView I have done the following: Implemented WKUIDelegate Set _webView.UIDelegate = self;

How can I turn off OS X's Smart Quotes replacement in my WKWebView?

随声附和 提交于 2020-04-16 02:34:07
问题 I'm developing a Mac application that contains a WKWebView. The HTML in the web view contains an input field into which the user types code (Ruby, in fact). When I type a quote (") into this field, it is automatically turned into a fancy curly quote (“). Since Ruby strings use ASCII quotes as delimiters this is wrong. At the moment I'm taking what the user enters and substituting from curly quotes to ASCII quotes before using the code, but obviously this is not ideal. I can't figure out how I

Download embedded PDF loaded in WKWebView

怎甘沉沦 提交于 2020-04-10 08:37:33
问题 While loading HTML5 page from url I'm getting pdf somewhere in that page and I have to download that pdf or save it as base64 . This is where the pdf is in the HTML code. I cannot simply hit the 'src' URL and get the pdf. < embed width="100%" height="100%" name="plugin" id="plugin" src="https://myurl.com/fileToOpen.pdf” type="application/pdf" internalinstanceid="8" title=""> Any JS which can help me get base64 string of that or any other method to download? 回答1: Update From the Docs they say

WKWebView bottom constraint set but won't work

时光怂恿深爱的人放手 提交于 2020-04-10 03:18:10
问题 I have set WKWebView bottom constraint to superview but it won't display till superview instead displays content till safe area. Here is the problem image that displays the bottom part doesn't fill properly. And here is the hierarchy of view and constraints image And code to setup WebView constraints with container view let wv = WKWebView(frame: containerView.frame, configuration: wvConfig) webView = wv containerView.addSubview(wv) // setup constraints wv

Angular 2.0 router navigation not working on iOS WKWebView

拜拜、爱过 提交于 2020-03-21 11:26:07
问题 Because of some performance issues, I'm trying to upgrade an angularJS2/phonegap app to use WKWebView on iOS. Unfortunately, any calls to route navigate do not work. This includes routerlink and this.route.navigate calls. There are no errors being thrown. Has anyone else seen this and/or perhaps have a workaround? The code works fine using the normal UIWebView. I'm a relative newbie to Angular so any suggestions are welcomed. Here's what some of the relevant code looks like: import {

Issue with observing WKWebView URL changes via JavaScript events

风格不统一 提交于 2020-03-20 14:54:08
问题 I have a WKWebView that presents a Laravel web application. I currently have my ViewController setup to catch URL changes – and it catches most of them. However, there are a small number of URL changes that are made via JavaScript events that WKWebView seems to ignore. I have tried all of the following solutions and implemented them in the code below: How to detect hash changes in WKWebView? How can I detect when url of amp page changed with WKWebview WKWebView function for detecting if the