How to work with a popup in an Android browser

I am developing a browser as an application using Webview for my own understanding.

It’s not yet clear how to work with pop-ups in an Android web browser.

I came across these methods onJsAlert() , onJsBeforeUnload() , onJsConfirm() , etc. to handle popup windows java script. from link as well as developer link

they work when there is jsAlert, but how do I handle the popup that opens in a new window?

I just want to know if there is any other way to handle pop-ups for websites in Android view, such as opening in a new tab or opening in a new window using webview.

I also have problems opening URLs that open in a new window in a regular browser. If I open any link from Twitter, then this URL is not loaded, but the twitter logo will look like one of the questions here

here is a screenshot from a regular Android browser , but it loads into my webview as a normal page, and not as a popup

enter image description here

+4
source share
1 answer

Try

  webViewObject.getSettings().setJavaScriptCanOpenWindowsAutomatically(true) 

if you want to open a window ... for example window.open thn. javascriptenable should be set to true. I hope I understood ur quest correctly.

+3
source

Source: https://habr.com/ru/post/1275851/


All Articles