从Android 4.4.x WebView中使用location.reload当打开一个标签在浏览器() [英] Android 4.4.x WebView opens a tab in the browser when using location.reload()

查看:6081
本文介绍了从Android 4.4.x WebView中使用location.reload当打开一个标签在浏览器()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有这些在浏览器中打开一个新的标签与我的应用程序的URL,

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 = ''

这是因为Android 4.4的新的行为。

It's new behavior since Android 4.4.

我真的preFER到一个新的Andr​​oid包不上传到店,简单地修复location.reload()。整个原因,我重装是刷新我的应用程序缓存我刚刚更新。这是正常的,并鼓励移动网络的工作流程。

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.

我希望有出有什么我还没有从JavaScript尝试,将工作。

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

推荐答案

您是否尝试过使用类似的WebClient的这个

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;
}

}

这篇关于从Android 4.4.x WebView中使用location.reload当打开一个标签在浏览器()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆