android webview private browsing[Android 隱私視窗]
android webview private browsing[Android 隱私視窗]
資料來源:http://stackoverflow.com/questions/11244890/android-webview-enable-private-browsing
資料來源:http://stackoverflow.com/questions/9819325/android-webview-private-browsing
WebView webView = new WebView(this, null, R.id.webView1, true);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(“google.com”);
Log.v(“PrivateBrowsing”, “” + webView.isPrivateBrowsingEnabled());
/*
Cool. Thats creates a webview and opens url. But webview.isPrivateBrowsingEnabled() returns false WebView webView = new WebView(this, null, R.id.webView1, true); webView = (WebView) findViewById(R.id.webView1); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(“google.com”); Log.v(“PrivateBrowsing”, “” + webView.isPrivateBrowsingEnabled());
*/
—————————————
//Make sure No cookies are created
CookieManager.getInstance().setAcceptCookie(false);
//Make sure no caching is done
myWebView.getSettings().setCacheMode(mWebView.getSettings().LOAD_NO_CACHE);
myWebView.getSettings().setAppCacheEnabled(false);
myWebView.clearHistory();
myWebView.clearCache(true);
//Make sure no autofill for Forms/ user-name password happens for the app
myWebView.clearFormData();
myWebView.getSettings().setSavePassword(false);
myWebView.getSettings().setSaveFormData(false);