parent.opener不web视图Android的工作 [英] parent.opener doesn't work in webview Android

查看:161
本文介绍了parent.opener不web视图Android的工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题。我需要回到父网​​址从框架中的Andr​​oid打开网​​页视图

I have a problem. I need to return to parent Url from Frame opened in a Android Webview.

的顺序是:在网​​页视图新帧打开。选择框架选项和paramters。在框架调用的JavaScript 之类的函数_的javascript:parent.opener的 jsfunction 的_。父网站无法打开......
我没有访问Web。我只在Android中端工作。

The sequence is: Open inside Webview new frame. Select in frame options and paramters. Call in frame javascript function like _"javascript:parent.opener.jsfunction"_. Parent Web doesn't open... I don't have access to Web. I work only in Android side.

在Android版Firefox我测试网站和它的作品。

I test Web in a firefox for Android and it works.

需要帮助。

推荐答案

默认情况下,的WebView 不支持多个窗口。如果你检查,我相信字段实际上没有设置并没有指向父窗口(或任何东西)。这同样适用于其他类似的领域,比如揭幕战

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.

您可能能够通过<一个通过这个工作href=\"http://developer.android.com/reference/android/webkit/WebSettings.html#setSupportMultipleWindows%28boolean%29\"相对=nofollow>多窗口的启用支持然后实施<一个href=\"http://developer.android.com/reference/android/webkit/WebChromeClient.html#onCreateWindow%28android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message%29\"相对=nofollow> onCreateWindow WebChromeClient 。我认为有一些你所要做的,但它已经有一段时间,我不记得细节。

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.

我已经在过去解决这个黑客攻击的一个方法是用<一href=\"http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface%28java.lang.Object,%20java.lang.String%29\"相对=nofollow> setJavascriptInterface ,只是将名称设置为或你想要哪个领域。实施适当的方法在必要的Java对象。这可以得到一个有点乱,但很有效。

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.

这篇关于parent.opener不web视图Android的工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆