Open scottywaz opened 6 years ago
The page should define window.onbeforeunload
as in the stackoverflow page you described. If you want to remove it, you can utilize EvaluateJS()
as below (please adjust the timeout delay adequately):
--- a/sample/Assets/Scripts/SampleWebView.cs
+++ b/sample/Assets/Scripts/SampleWebView.cs
@@ -46,6 +46,7 @@ public class SampleWebView : MonoBehaviour
ld: (msg) =>
{
Debug.Log(string.Format("CallOnLoaded[{0}]", msg));
+ webViewObject.EvaluateJS(@"setTimeout(function() { window.onbeforeunload = null; }, 1000);'");
#if !UNITY_ANDROID
// NOTE: depending on the situation, you might prefer
// the 'iframe' approach.
Any ideas why this would be Android only and not seen on iOS?
That is because beforeunload
isn't supported on iOS:
https://caniuse.com/#search=beforeunload
Android version of our app is getting this popup when trying to navigate to a URL.![screen shot 2018-02-12 at 4 21 54 pm](https://user-images.githubusercontent.com/21161358/36120345-df363f82-1010-11e8-8f8b-596bed6e9c7b.png)
I attempted to do this in the sample and it works fine. We do have other plugins in our codebase and I'm wondering if anyone knows of an Android Manifest setting that I missed or might be causing this.
In my googling around this is the only related thing I could find: stackoverflow So do I need to add Native code and add this line?