简体   繁体   中英

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

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

        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. window.close will not work because that does not close the 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. This would close the web view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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