? Support the WKWebView with Appcelerator's Titanium Mobile
evalJS
as deprecated on iOS 12+ due to internal iOS-changes (MOD-2464)Since iOS 12.0, using evalJS
in sync is not possible anymore, because the internal callback is now
called on the main thread, causing a deadlock in the run-loop that is used to return the value synchronously.
To fix this, please use the asynchronous solution:
- alert(webView.evalJS('document.title'));
+ webView.evalJS('document.title', function (e) {
+ alert(e.result);
+ });
scalePageToFit
=> scalesPageToFit
Note: Titanium SDK 8.0.0+ will use the WKWebView
class for the Ti.UI.WebView
API by default and the minimum target will be iOS 9.0.
Using the module in Alloy:
<Alloy>
<WebView module="ti.wkwebview" url="https://appcelerator.com" />
</Alloy>
addUserScript
methodremoveAllUserScripts
methodaddScriptMessageHandler
methodremoveScriptMessageHandler
methodhandleurl
event to handle custom URL schemes (#17) by @anthonychungwebView.addEventListener('handleurl', function(e) {
Ti.API.info('Handling URL: ' + e.url);
Ti.Platform.openURL(e.url);
e.handler.invoke(WK.ACTION_POLICY_CANCEL); // or ACTION_POLICY_ALLOW
});
initial-scale=1, maximum-scale=1
to user-script used for scalePageToFit
disableZoom
, scalePageToFit
and disableContextMenu
on initial usage (#16)