1

I have a normal HTML/Javascript site witch is working in all browser perfectly. I registered now that, if someone is visiting my site via android-webview, javascript is disabled by default. On my page I have a pricelist witch will be open by adding a class with javascript. Thats means if my site is visited with webview the pricelist is not shown. Is there any solution to enable javascript in this case? I found something like this:

<WebView javaScriptEnabled={true}/>

or:

webSettings.setJavaScriptEnabled(true);

or:

webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);

But I dont have any glue is this right and were to place it it my code.

And: Is there something like is webview in window

5
  • You can't do it from the site. That has to be done in the android app with the webview. If the app doesn't do it, you can't turn it on (what a security nightmare it would be if you could). Making sure you understood that, as you're talking about writing a website and not writing an app. Commented Mar 7, 2016 at 12:04
  • I'am writing a website NOT an app. Your answer means to me that webwiew will not be a complete browser. My form is working, the view of the site is ok. Only the important priclist is not shown because of missing javascript. Commented Mar 7, 2016 at 12:06
  • Yup. Of course any browser could be like that- lots of people turn off javascript for security reasons. And a webview might have it turned on- its just not a sure thing. Commented Mar 7, 2016 at 12:08
  • In this case there is a noscript tag. but webview is ignoring this too. Commented Mar 7, 2016 at 12:10
  • Hmm. That sounds like a bug WebView should fix, although googling doesn't see any other reports of that. But yeah, there's nothing you can do to turn it on. Commented Mar 7, 2016 at 12:12

2 Answers 2

1

this coding working well

webView=(WebView)findViewById(R.id.webView);
webView.setWebViewClient(new MyBrowser());
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.loadUrl(url);
Sign up to request clarification or add additional context in comments.

Comments

0

Well if understood correctly, the person who made the android app, thus the implementation of an android-webview, should enable javascript so that your site can be viewed correctly.

2 Comments

Sorry you understand wrong. There is no person who made an android app. My site will be visited by the build in browser of a standard android celular.
i see, maybe it would help if you could give a link to your site for further testing, and maybe mention what was the android version of the "standard" android celular that you were using to test the website, since not all webviews are implemented the same way. As is see it, you have done your part in building a "good" website, the problem of javascript not working on a "mobile phone" is the problem in the "mobile phone" not much you can do on your part.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.