Skip to content Skip to sidebar Skip to footer

Website Menu Bar Not Working With Webview Android While Working Fine In Mobile Browser

I'm working on WebView and opening a website using WebView android. The menu bar of the website is working fine in the mobile browser but when I open the URL/website in WebView and

Solution 1:

I added mWebSettings.setDomStorageEnabled(true) this line in my code and it's working fine now.

setDomStorageEnabled(boolean flag)

Sets whether the DOM storage API is enabled.

Because, the landing page provides controls that can be used to customize the colour, font and decorative image. When you choose different options, the page is instantly updated; in addition your choices are stored in localStorage, so that when you leave the page then load it again later on your choices are remembered.

In addition, if you load this page in another tab, then make changes to your choices in the landing page, you'll see the updated storage information outputted as the StorageEvent is fired.

Solution 2:

works for me by adding these two lines:

mywebView.getSettings().setDomStorageEnabled(true);
mywebView.getSettings().setJavaScriptEnabled(true);

Solution 3:

Yes, I have the same problem and by adding these lines of code its working perfectly.

publicclassMainActivityextendsAppCompatActivity {
    private WebView websiteView;

    @OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        websiteView = (WebView) findViewById(R.id.websiteview);
        WebSettingswebSettings= websiteView.getSettings();
        websiteView.getSettings().setDomStorageEnabled(true);
        websiteView.getSettings().setJavaScriptEnabled(true);
        webSettings.setJavaScriptEnabled(true);
        websiteView.loadUrl("https://abdulrahmanayub.com/");
        websiteView.setWebViewClient(newWebViewClient());

    }
}

Post a Comment for "Website Menu Bar Not Working With Webview Android While Working Fine In Mobile Browser"