Enabling general JavaScript in WebViewClient

I don’t know what your exact problem is, but i can enable the JavaScript and a custom WebViewclient without any problem: WebView vistaWeb = (WebView) findViewById(R.id.webview); vistaWeb.setWebChromeClient(new MyCustomChromeClient(this)); vistaWeb.setWebViewClient(new MyCustomWebViewClient(this)); vistaWeb.clearCache(true); vistaWeb.clearHistory(); vistaWeb.getSettings().setJavaScriptEnabled(true); vistaWeb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

Rendering HTML in a WebView with custom CSS

You could use WebView.loadDataWithBaseURL htmlData = “<link rel=\”stylesheet\” type=\”text/css\” href=\”style.css\” />” + htmlData; // lets assume we have /assets/style.css file webView.loadDataWithBaseURL(“file:///android_asset/”, htmlData, “text/html”, “UTF-8”, null); And only after that WebView will be able to find and use css-files from the assets directory. ps And, yes, if you load your html-file form the assets folder, you … Read more

Why does Android WebView sporadically not sending my session cookie?

Thanks justingrammens! That worked for me, I managed to share the cookie within my DefaultHttpClient requests and WebView activity: //——- Native request activity private DefaultHttpClient httpClient; public static Cookie cookie = null; //After Login List<Cookie> cookies = httpClient.getCookieStore().getCookies(); for (int i = 0; i < cookies.size(); i++) { cookie = cookies.get(i); } //——- Web Browser … Read more

Download file inside WebView

Have you tried? mWebView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); Example Link: Webview File Download – Thanks @c49

detect ipad/iphone webview via javascript

This uses a combination of window.navigator.userAgent and window.navigator.standalone. It can distinguish between all four states relating to an iOS web app: safari (browser), standalone (fullscreen), uiwebview, and not iOS. Demo: http://jsfiddle.net/ThinkingStiff/6qrbn/ var standalone = window.navigator.standalone, userAgent = window.navigator.userAgent.toLowerCase(), safari = /safari/.test( userAgent ), ios = /iphone|ipod|ipad/.test( userAgent ); if( ios ) { if ( !standalone … Read more