My tested on nexous one (compiled with android 2.2) shows that shouldOverrideUrlLoading is not triggered when the page is redirected via window.location.href. The onPageFinished is trigger as usual.
Could anyone advise how to intercept javascript page redirect? Any other way to redirect the page in javascript so shouldOverrideUrlLoading is triggered? Is this a bug for shouldOverrideUrlLoading?
Thanks,
June
In my case, when using window.location = "http://xxx"
in my webpage, the event shouldOverrideUrlLoading()
is not triggered.
However, if I use a custom url scheme or protocol such as androidurl://
, shouldOverrideUrlLoading()
is fired. My workaround would to be use a custom protocol and add the following code in the shouldOverrideUrlLoading()
method:
if (url.startsWith("androidurl://")) {
url = url.replaceAll("androidurl://", "http://");
}
This will change the custom protocol back to the http://
protocol and you can handle the correct url from there.
This works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With