Home » Android » java – How to disable local storage and session storage in webView-Exceptionshub

java – How to disable local storage and session storage in webView-Exceptionshub

Posted by: admin February 26, 2020 Leave a comment

Questions:

I want to disable the local storage and the session storage in a webView, in Android. I have tried the next configuration:

    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setGeolocationEnabled(true);
    webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webSettings.setDomStorageEnabled(false);
    webSettings.setDatabasePath(null);
    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
    webSettings.setAppCacheEnabled(false);
    webSettings.setAppCachePath(null);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setUseWideViewPort(true);
    webSettings.setBuiltInZoomControls(true);

    webSettings.setSaveFormData(false);
    webSettings.setSavePassword(false);
    webSettings.setDomStorageEnabled(false);

But it’s still generating relevant info which could be potentially insecure. Has anyone faced this problem before?

How to&Answers: