androidwordpresswebviewanchor

Android WebView does not work with Wordpress menu based on Anchor Link (Jump Link)


I developing simple app which has to display website in a webview. Webside is build in word press and button which suppose open the menu does not work (it does work in normal browser).

Container of the menu:

<nav id="access" role="navigation" class="mm-menu mm-horizontal mm-current mm-opened"> ..</nav>

Link to the menu:

<a href="#access" id="menu-btn" class="active"></a>

When i click on the link from regular browser menu slight from right but url is not affected i mean it is stil SomeDomain.com instead of SomeDomain.com/#access.

Important info:

-I already try to reload link in onPageFinished (with and without adding #access at the end)

-My webView is NOT in the ScrollView

-i have set webViewSettings.setJavaScriptEnabled(true);

I'm loading my web like: mainWebView.loadUrl(url);

Do you have any ideas how to fix that ?


Solution

  • I finally figure that out, problem was that my webview was not fully support html5:

    mWebView.setFocusable(true);
    mWebView.setFocusableInTouchMode(true);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setPluginsEnabled(true);
    mWebView.getSettings().setRenderPriority(RenderPriority.HIGH);
    mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    mWebView.getSettings().setDomStorageEnabled(true);
    mWebView.getSettings().setDatabaseEnabled(true);
    mWebView.getSettings().setAppCacheEnabled(true);
    mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);