出于我自己的理解,我正在使用 Webview 开发类似浏览器的应用程序.
I am developing browser like application using a Webview for my own understanding.
我还不清楚如何在 android Webview 中使用弹出窗口.
I am not yet clear how to work with pop-ups in android Webview.
我遇到了 onJsAlert()
、onJsBeforeUnload()
、onJsConfirm()
等方法来处理 java 脚本弹出窗口.从这个 link 和 开发者链接
I came across these methods onJsAlert()
, onJsBeforeUnload()
, onJsConfirm()
etc to handle java script pop ups. from this link and also developer link
当有 jsAlert 时这些工作,但我如何处理在新窗口中打开的弹出窗口?
these work when there is a jsAlert but how do i handle pop-up which opens in new window ?
我只是想知道有没有其他方法可以处理 android webview 中网站的弹出窗口,例如在新选项卡中打开或使用 webview 在新窗口中打开.
I just want to know is there is any other way to handle pop up for websites in android webview like opening in new tab or open in new window using webview.
我也无法在普通浏览器中打开在新窗口中打开的 url.如果我从 twitter 打开一些链接,则此 url 未加载,但 twitter 徽标类似于问题之一 这里
I am also having trouble to open urls which are opened in new window in normal browser.e.h If I open some link from twitter then this url is not loaded but twitter logo is seen similar to one of the questions here
这是来自普通安卓浏览器的快照,但这是作为普通页面而不是弹出页面加载到我的 webview 中的
here is the snap shot from normal android browser but this is loaded in my webview as a normal page not as pop-up
试试
webViewObject.getSettings().setJavaScriptCanOpenWindowsAutomatically(true)
如果你想打开窗口......就像 window.open 一样,它是必需的.对于 javascriptenable 应该设置为 true.. 希望我理解你的请求正确.
if you want to open window...like window.open thn its required. for the javascriptenable should be set to true.. hope i understand ur quest correct.
这篇关于如何在 android webview 中使用弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!