Android 在 Cordova 中加载外部 URL 时出现“net::ERR_CACHE_MISS”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25282063/
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
"net::ERR_CACHE_MISS" when loading an external URL in Cordova
提问by czery
I am getting crazy about this. I have a pretty basic Cordova (3.5.0) app and want to load an external URL. The only thing I am doing is loading jQuery (locally) and executing this on button click:
我对这个越来越疯狂了。我有一个非常基本的 Cordova (3.5.0) 应用程序并且想要加载一个外部 URL。我唯一要做的就是加载 jQuery(本地)并在单击按钮时执行此操作:
$.ajax({
dataType:'html',
url:'http://www.google.com',
success:function(data) {
$('#ajax').html($(data).children());
}
});
Everytime on loading my app fires this error:
每次加载我的应用程序时都会触发此错误:
GET http://www.google.com/ net::ERR_CACHE_MISS jquery.min.js:4
send jquery.min.js:4
m.extend.ajax jquery.min.js:4
(anonymous function) index.html:68
m.event.dispatch jquery.min.js:3
r.handle jquery.min.js:3
All permissions are properly set in the AndroidManifest.xml
所有权限都在 AndroidManifest.xml 中正确设置
<uses-permission android:name="android.permissions.INTERNET" />
<uses-permission android:name="android.permissions.NETWORK_ACCESS" />
<uses-permission android:name="android.permissions.ACCESS_NETWORK_STATE" />
Does anyone of you had a similar issue? What does net::ERR_CACHE_MISS means?
你们中有人有类似的问题吗?net::ERR_CACHE_MISS 是什么意思?
采纳答案by czery
Oh damn... sometimes you just need to step back... Beginner's mistake: it is android.permission. and not android.permissions. Resolved!
哦该死的......有时你只需要退后一步......初学者的错误:它是android.permission。而不是 android.permissions。解决!
回答by Tadej
All i had to do was:
我所要做的就是:
cordova platform remove android
cordova platform add android
and the "net::ERR_CACHE_MISS" error disappeared. I have no idea what the reason was.
并且“net::ERR_CACHE_MISS”错误消失了。我不知道是什么原因。
回答by Orlando Lacerda
The used syntax is wrong.
使用的语法是错误的。
Your used:
您使用的:
<uses-permission android:name="android.permissions.INTERNET" />
<uses-permission android:name="android.permissions.NETWORK_ACCESS" />
<uses-permission android:name="android.permissions.ACCESS_NETWORK_STATE" />
Correct:
正确的:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NETWORK_ACCESS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Name "android.permission" is singular.
名称“android.permission”是单数。
回答by MJPinfield
net::ERR_CACHE_MISSis not a bad error, it simply means the page loaded has not been cached, if you go to a cached page the error should not show up. Most pages now will show this error, and while annoying it shouldn't do any damage to your application.
net::ERR_CACHE_MISS不是一个严重的错误,它只是意味着加载的页面没有被缓存,如果你去一个缓存的页面,错误不应该出现。现在大多数页面都会显示这个错误,虽然很烦人,但它不应该对您的应用程序造成任何损害。
回答by Rajnikant Lodhi
Failed to load resource: net::ERR_CACHE_MISS
无法加载资源:net::ERR_CACHE_MISS
This can be removed by simply running these commands
这可以通过简单地运行这些命令来删除
ionic cordova platform rm android --save
ionic cordova platform add android --save
ionic cordova platform rm android --save
ionic cordova platform add android --save
回答by Pradeep Behera
solved by adding internet permission in manifesto file
通过在宣言文件中添加互联网权限解决
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET" />