[英]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
. 我需要从在Android
Webview
打开的Frame返回到父Url
。
The sequence is: Open inside Webview
new frame. 顺序为:在
Webview
新框架内打开。 Select in frame options and paramters. 选择框架中的选项和参数。 Call in frame
javascript
function like _"javascript:parent.opener. jsfunction "_. 调用框架内的
javascript
函数,例如_“ javascript: parent.opener。jsfunction ” _。 Parent Web doesn't open... I don't have access to Web. 父网站未打开...我无权访问网络。 I work only in Android side.
我只在Android方面工作。
I test Web in a firefox for Android and it works. 我在Android的firefox中测试了Web,并且可以正常工作。
Need help. 需要帮忙。
By default, WebView
doesn't support multiple windows. 默认情况下,
WebView
不支持多个窗口。 If you check, I believe the parent
field actually isn't set and doesn't point to the parent window (or anything at all). 如果您进行检查,我相信实际上未设置
parent
字段,并且它不指向父窗口(或任何其他窗口)。 The same applies to other similar fields like opener
and top
. 这同样适用于其他类似字段,例如
opener
和top
。
You might be able to work through this by enabling support for multiple windows and then implementing onCreateWindow
in your WebChromeClient
. 您可以通过启用对多个窗口的支持 ,然后在
WebChromeClient
实现onCreateWindow
来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. 我过去解决此问题的一种方法是使用setJavascriptInterface ,并将名称设置为
parent
或所需的任何字段。 Implement the appropriate methods as necessary on your Java object. 根据需要在Java对象上实现适当的方法。 This can get a bit messy, but it works.
这可能会有点混乱,但是可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.