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

2 Answers 2

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());
Sign up to request clarification or add additional context in comments.

Comments

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

4 Comments

I tried that already but it's not working. Do i need special permissions or something like that?
you do need to add this permission but not javascript related <uses-permission android:name="android.permission.INTERNET" />
If you want to run native javascript code, you better check this official android link about web views LINK Start reading where it says "Enabling Javascript in WebView"
And one more thing, the link in your post is broken

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.