Android Webview: "Uncaught TypeError: Cannot read property 'getItem' of null"

AndroidWebview

Android Problem Overview


I am creating a simple android app which has a webview which should display a url. When I give the url as google.com or facebook.com it loads properly but when I give my url(qbo.intuit.com), it doesn't load and gives the "Uncaught TypeError: Cannot read property 'getItem' of null" error. I am pasting my code here well. I am using Compile sdk version: API 22: Android 5.1 (Lollipop), Version- Android Studio 1.4, Build Number: AI-141.2288178, Android SDK Tools: 24.4.0, jdk1.7.0_80. A similar question exists but it did not help me. Please help I am new to android. MainActivity.java

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    String url= "https://qbo.intuit.com/";
    WebView view= (WebView) this.findViewById(R.id.webView);

     final WebViewClient client = new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return false;
        }

    };

        WebSettings settings = view.getSettings();
        settings.setJavaScriptEnabled(true);
    view.setWebViewClient(client);
        view.loadUrl(url);


}

AndriodManifest.xml

<?xml version="1.0" encoding="utf-8"?>

http://schemas.android.com/apk/res/android" package="com.test.sjha3.webapp" >

<uses-permission android:name="android.permission.INTERNET"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Android Solutions


Solution 1 - Android

you need to do

WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);

see details https://stackoverflow.com/questions/5822256/error-web-console-uncaught-typeerror-cannot-call-method-getitem-of-null-at-h

Solution 2 - Android

WebSettings settings = webView.getSettings();
settings.setDomStorageEnabled(true);

this two line of code you add your Activity then all js,jquery file in the add-in URL is open in your WebView

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSonalView Question on Stackoverflow
Solution 1 - AndroidAshish RawatView Answer on Stackoverflow
Solution 2 - Androidsaurabh aswalView Answer on Stackoverflow