3

All these open a new tab with my app url, in the browser:

location.reload()
document.location.reload()
window.location.reload()
window.location.href = window.location.pathname
window.location.search = ''

It's new behavior since Android 4.4.

I'd really prefer to not upload a new Android package to the store, to simply fix location.reload(). The whole reason I'm reloading is to refresh my appcache I just updated. Which is a normal and encouraged mobile web workflow.

I'm hoping there is something out there I haven't tried from javascript that will work.

Geek Devigner
  • 349
  • 2
  • 12

1 Answers1

1

Have you tried using a webClient like this one

private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
    return true;
}

}

Community
  • 1
  • 1
insomniac
  • 11,146
  • 6
  • 44
  • 55
  • Thank you for answering. I understand native solutions exist, but I'd like to do this from javascript, to prevent code fragmentation across all my mobile targets. I'll update my question. – Geek Devigner Dec 11 '13 at 03:55
  • 1
    Note from official docs: `Do not call WebView#loadUrl(String) with the request's URL and then return true. This unnecessarily cancels the current load and starts a new load with the same URL. The correct way to continue loading a given URL is to simply return false, without calling WebView#loadUrl(String).` https://developer.android.com/reference/android/webkit/WebViewClient – jakub.g Mar 06 '20 at 17:22