how to work with pop ups window in android webview

nishi picture nishi · Apr 16, 2012 · Viewed 7.5k times · Source

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

I am not yet clear how to work with pop-ups in android Webview.

I came across these methods onJsAlert(), onJsBeforeUnload(), onJsConfirm() etc to handle java script pop ups. from this link and also developer link

these work when there is a jsAlert but how do i handle pop-up which opens in new window ?

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.

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

here is the snap shot from normal android browser but this is loaded in my webview as a normal page not as pop-up

enter image description here

Answer

user1140237 picture user1140237 · Apr 16, 2012

Try

 webViewObject.getSettings().setJavaScriptCanOpenWindowsAutomatically(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.