简体   繁体   English

Webview:window.close无法正常工作

[英]Webview: window.close not working

i have developed the android application with web view, i here load my sample html file which create the pop window, but in android web view i dnt get the pop up instead of that pop window override the previous window .i using window.open to create pop up 我已经开发了具有Web视图的android应用程序,我在这里加载了创建弹出窗口的示例html文件,但是在android Web视图中,我没有弹出窗口而不是那个弹出窗口覆盖了以前的窗口。创建弹出

if i want close that window means i have to use window.close in my script but this not working in android web view and also i gave the all permission 如果我想关闭该窗口,则意味着我必须在脚本中使用window.close,但这在android web视图中不起作用,并且我还授予了所有权限

        WebSettings settings = Browser.getSettings();  
        settings.setSupportMultipleWindows(true);
        settings.setJavaScriptEnabled(true); 
        Browser.setWebViewClient(new WebViewClient());
        Browser.setWebChromeClient(new WebChromeClient());
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setBuiltInZoomControls(true);
        Browser.requestFocusFromTouch();

if i load the same page in browser it works properly. 如果我在浏览器中加载同一页面,它将正常工作。 is't possible to create pop in web view 无法在网络视图中创建流行音乐

If you want to show a pop-up with the new page, you will need to call back into java to create an android dialog view over the web view and load another web view into that. 如果要显示新页面的弹出窗口,则需要回调到Java中以在Web视图上创建一个android dialog视图,然后在其中加载另一个Web视图。 window.close will not work because that does not close the web view ; window.close将不起作用,因为这不会关闭web view it still remains open. 它仍然保持开放。 Instead, you will need to call back into java again and finish() the activity that has the web view open. 取而代之的是,您将需要再次调用java并finish()打开Web视图的活动的finish() This would close the web view. 这将关闭Web视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM