Skip to content Skip to sidebar Skip to footer

Parent.opener Doesn't Work In Webview Android

I have a problem. I need to return to parent Url from Frame opened in a Android Webview. The sequence is: Open inside Webview new frame. Select in frame options and paramters. Call

Solution 1:

By default, WebView doesn't support multiple windows. If you check, I believe the parent field actually isn't set and doesn't point to the parent window (or anything at all). The same applies to other similar fields like opener and top.

You might be able to work through this by enabling support for multiple windows and then implementing onCreateWindow in your WebChromeClient. I think there's some more you have to do, but it's been a while and I don't recall the details.

One way I've hacked around this in the past is to use setJavascriptInterface and just set the name to parent or whichever field you want. Implement the appropriate methods as necessary on your Java object. This can get a bit messy, but it works.


Post a Comment for "Parent.opener Doesn't Work In Webview Android"