dbalman Member Licensed User Longtime User Feb 5, 2016 #1 I switched from the WebView to the WKWebview. It seems that the stringByEvaluatingJavaScriptFromString method does not exist? Is there a replacement method or a different way to inject JS? Code: Method not found: stringByEvaluatingJavaScriptFromString:, target: <WKWebView: 0x14b0be00; frame = (0 0; 414 667); layer = <CALayer: 0x1467add0>>
I switched from the WebView to the WKWebview. It seems that the stringByEvaluatingJavaScriptFromString method does not exist? Is there a replacement method or a different way to inject JS? Code: Method not found: stringByEvaluatingJavaScriptFromString:, target: <WKWebView: 0x14b0be00; frame = (0 0; 414 667); layer = <CALayer: 0x1467add0>>
JanPRO Well-Known Member Licensed User Longtime User Feb 6, 2016 #2 Use the new EvaluateJavaScript method Upvote 0
dbalman Member Licensed User Longtime User Feb 6, 2016 #3 I saw that addition, but I don't understand how it works and cannot find documentation on it or examples of it. Please provide an example explaining how to inject JS using this method. Upvote 0
I saw that addition, but I don't understand how it works and cannot find documentation on it or examples of it. Please provide an example explaining how to inject JS using this method.
JanPRO Well-Known Member Licensed User Longtime User Feb 6, 2016 #4 I didn't test it: Code: aWebView.EvaluateJavaScript("Test","alert('Hello, World!');") Sub EventName_JSComplete (Success As Boolean, Tag As Object, Result As String) Select Tag Case "Test" If Success Then Log("JS finish") End If End Select End Sub Upvote 0
I didn't test it: Code: aWebView.EvaluateJavaScript("Test","alert('Hello, World!');") Sub EventName_JSComplete (Success As Boolean, Tag As Object, Result As String) Select Tag Case "Test" If Success Then Log("JS finish") End If End Select End Sub
dbalman Member Licensed User Longtime User Feb 6, 2016 #6 JanPRO said: I didn't test it: Code: aWebView.EvaluateJavaScript("Test","alert('Hello, World!');") Sub EventName_JSComplete (Success As Boolean, Tag As Object, Result As String) Select Tag Case "Test" If Success Then Log("JS finish") End If End Select End Sub Click to expand... I spoke too soon. EvaluateJavaScript is not a valid member of WKWebView. Any other ideas? Upvote 0
JanPRO said: I didn't test it: Code: aWebView.EvaluateJavaScript("Test","alert('Hello, World!');") Sub EventName_JSComplete (Success As Boolean, Tag As Object, Result As String) Select Tag Case "Test" If Success Then Log("JS finish") End If End Select End Sub Click to expand... I spoke too soon. EvaluateJavaScript is not a valid member of WKWebView. Any other ideas?
dbalman Member Licensed User Longtime User Feb 6, 2016 #7 Never mind. I still had my view declared as a WebView instead of a WKWebView. Doah! Upvote 0
Erick Kalugdan Member Licensed User Jun 29, 2016 #8 I am new to B4i. How do I use WKWebView? Is there a sample project available? Upvote 0
JanPRO Well-Known Member Licensed User Longtime User Jun 29, 2016 #9 Hi, Erick Kalugdan said: How do I use WKWebView? Click to expand... You have to add WKWebView via the Designer: 1.) Add a reference to iUI8 in the "Libraries Manager" tab 2.) Add #MinVersion: 8.0 to your project attributes 3.) Go into the Designer, click Add View-->CustomView-->WKWebView 4.) Now you can use WKWebView like a normal WebView Finish Jan Last edited: Jun 29, 2016 Upvote 0
Hi, Erick Kalugdan said: How do I use WKWebView? Click to expand... You have to add WKWebView via the Designer: 1.) Add a reference to iUI8 in the "Libraries Manager" tab 2.) Add #MinVersion: 8.0 to your project attributes 3.) Go into the Designer, click Add View-->CustomView-->WKWebView 4.) Now you can use WKWebView like a normal WebView Finish Jan