问题描述
我从头开始创建了一个新的Phonegap 2.5项目,我一直在尝试加载一个外部URL,但我不断收到输入框在启动时弹出,然后加载实际的URL。我首先得到一个弹出窗口的网站的URL,然后在输入框中,它说DeviceInfo,Device652321624。如果我单击取消,它在加载网站之前再弹出2次。在网站本身,它加载一些相对URL,但其他人导致整个页面刷新和输入框再次弹出。
I created a new Phonegap 2.5 project from scratch, and I've been trying to load an external URL in it, but I keep getting input boxes popping up on startup before loading the actual URL. I first get a pop-up with the URL of the website, then in the input box it says "DeviceInfo","Device652321624". If I click Cancel, it pops up 2 more times before loading the website. On the website itself, it loads some relative URLs, but others cause the entire page to refresh and the input boxes to pop up again.
我设置的URL通过设置< content src =http://phonegap.example.com/>
,这只是一个使用Javascript的常规网站。我甚至尝试注释掉所有Phonegap特定的代码(没有更多的 ondeviceready
调用),但它仍然导致的问题。 http://www.google.com
为我加载,因此我不确定要检查什么。
I set the URL by setting <content src="http://phonegap.example.com" />
, which is just a regular website with Javascript. I even tried commenting out all Phonegap specific code (no more ondeviceready
calls), but it still causes the problem. http://www.google.com
loads for me, so I'm not sure what else to check. And it works with the Android version that I've developed.
如果有帮助,我也在XCode日志中看到这个消息:由于网页载入而重置插件。
If it helps, I've also seen this message in the XCode log: Resetting plugins due to page load.
推荐答案
我今天遇到了同样的问题。
我通过检查cordova.js文件的include来修复它(这个js是在使用 create
命令创建项目时生成的)
在重命名的cordova项目版本中称为cordova.js。在phonegap中可能是phonegap.js?)
I've had the exact same problem today.I fixed it by checking the include of the cordova.js file (this js is generated when you create the project using the create
command.( called cordova.js in the renamed cordova project version. probably phonegap.js in phonegap ?)
无论如何我的include是:
anyway my include was :
<script type="text/javascript" src="js/cordova.js"></script>
,而je js文件位于项目根目录中:
whereas je js file was in the project root :
我将其更改为
<script type="text/javascript" src="cordova.js"></script>
现在一切都很好了。
create
'生成一个不同的js文件。make sur使用为ios生成的新文件。
also, the 'create
' command for Android generate a different js file. make sur that the new one generated for ios is used.
希望有所帮助!
这篇关于在Phonegap 2.5中加载外部URL时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!