4

Is it possible to open a javascript popup window on a android webviewer coded like this example from google? and if yes how? I dont want that the original page in the background is closed it has to be a popup like on the picture.

Building Web Apps link

enter image description here

Aravin
  • 4,126
  • 1
  • 23
  • 39
user3235860
  • 41
  • 1
  • 1
  • 3

2 Answers2

4

See answers to this question:

JavaScript alert not working in Android WebView

The answer from Stephen Quan is to just set the default webChromeClient

mWebView.setWebChromeClient(new WebChromeClient());
Community
  • 1
  • 1
Display name
  • 2,697
  • 2
  • 31
  • 49
1

You can allow javascript and opening windows from javascript in a webview. Just set this settings

webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

Be careful though because enabling javascript on your app webview can bring some serious security issues

check this links

From StackOverflow

Interesting Presentacion

and this one for webviews

Official Android WebView Link

Community
  • 1
  • 1
klifa
  • 671
  • 1
  • 8
  • 27
  • I tried that already but it's not working. Do i need special permissions or something like that? – user3235860 Jan 25 '14 at 19:01
  • you do need to add this permission but not javascript related – klifa Jan 25 '14 at 19:07
  • If you want to run native javascript code, you better check this official android link about web views [LINK](http://developer.android.com/guide/webapps/webview.html) Start reading where it says "Enabling Javascript in WebView" – klifa Jan 25 '14 at 19:09
  • And one more thing, the link in your post is broken – klifa Jan 25 '14 at 19:17