Android 在 window.open 上获取 ERR_CACHE_MISS
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22301474/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Getting ERR_CACHE_MISS on window.open
提问by Asaf
I'm using PhoneGap (cordova 2.9.1, android 4.4.2) and trying to open an external URL in the current view:
我正在使用 PhoneGap(cordova 2.9.1,android 4.4.2)并尝试在当前视图中打开外部 URL:
document.addEventListener("deviceready", function(){
window.open('http://www.google.com', '_self')
});
But I'm receiving the following error:
但我收到以下错误:
net::ERR_CACHE_MISS (http://www.google.com)
net::ERR_CACHE_MISS ( http://www.google.com)
Any ideas ?
有任何想法吗 ?
回答by Asaf
The issue ended up being a missing permission, namely, INTERNET permission.
For some reason I was under the impression that ACCESS_NETWORK_STATE is enough.
To solve the issue, just add this to AndroidManifest.xml:
问题最终是缺少权限,即 INTERNET 权限。
出于某种原因,我的印象是 ACCESS_NETWORK_STATE 就足够了。
要解决此问题,只需将其添加到AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />