You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in case web page show alert "This site is trying to open another application." alert not shown inside WebView window (works well on chrome mobile)
#1048
This plugin doesn't forbid intents by default as it mainly targets trusted origins. You may utilize SetURLPattern() (cf. #550) to hook intents and show a warning dialog in unity.
I cannot help about how the metamask app works for the url. As noted before, it might be better to use SFSafariViewController/Chrome Custom Tabs. Moreover, it might be better to utilize MetaMask SDK: https://docs.metamask.io/wallet/how-to/use-sdk/mobile/ .
page https://myhome2.cfc.io/wc/
code:
WebViewObject webViewObject;
IEnumerator StartWebView()
{
webViewObject = (new GameObject("WebViewObject")).AddComponent();
webViewObject.Init(
cb: (msg) =>
{
Debug.Log(string.Format("CallFromJS[{0}]", msg));
},
err: (msg) =>
{
Debug.Log(string.Format("CallOnError[{0}]", msg));
},
httpErr: (msg) =>
{
Debug.Log(string.Format("CallOnHttpError[{0}]", msg));
},
started: (msg) =>
{
Debug.Log(string.Format("CallOnStarted[{0}]", msg));
},
hooked: (msg) =>
{
Debug.Log(string.Format("CallOnHooked[{0}]", msg));
},
cookies: (msg) =>
{
Debug.Log(string.Format("CallOnCookies[{0}]", msg));
},
ld: (msg) =>
{
Debug.Log(string.Format("CallOnLoaded[{0}]", msg));
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IOS
// NOTE: the following js definition is required only for UIWebView; if
// enabledWKWebView is true and runtime has WKWebView, Unity.call is defined
// directly by the native plugin.
#if true
var js = @"
if (!(window.webkit && window.webkit.messageHandlers)) {
window.Unity = {
call: function(msg) {
window.location = 'unity:' + msg;
}
};
}
";
#else
// NOTE: depending on the situation, you might prefer this 'iframe' approach.
// cf. #189
var js = @"
if (!(window.webkit && window.webkit.messageHandlers)) {
window.Unity = {
call: function(msg) {
var iframe = document.createElement('IFRAME');
iframe.setAttribute('src', 'unity:' + msg);
document.documentElement.appendChild(iframe);
iframe.parentNode.removeChild(iframe);
iframe = null;
}
};
}
";
#endif
#elif UNITY_WEBPLAYER || UNITY_WEBGL
var js = @"
window.Unity = {
call:function(msg) {
parent.unityWebView.sendMessage('WebViewObject', msg);
}
};
";
#else
var js = "";
#endif
webViewObject.EvaluateJS(js + @"Unity.call('ua=' + navigator.userAgent)");
},
//transparent: false,
//zoom: true,
//ua: "custom user agent string",
//radius: 0, // rounded corner radius in pixel
//// android
//androidForceDarkMode: 0, // 0: follow system setting, 1: force dark off, 2: force dark on
//// ios
enableWKWebView: true
//wkContentMode: 0, // 0: recommended, 1: mobile, 2: desktop
//wkAllowsLinkPreview: true,
//// editor
//separated: false
);
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
webViewObject.bitmapRefreshCycle = 1;
#endif
// cf. #512
// Added alertDialogEnabled flag to enable/disable alert/confirm/prompt dialogs. by KojiNakamaru · Pull Request #512 · gree/unity-webview
webViewObject.SetAlertDialogEnabled(true);
The text was updated successfully, but these errors were encountered: