PhoneGap:无法加载外部网站
我正在尝试在 PhoneGap 应用程序中显示一个页面,例如 www.google.com。但是,我无法在 Safari 中打开页面,更不用说在 PhoneGap 中(这是我的最终目标)。
我看到这篇文章:PhoneGap for iPhone:加载外部 URL 时出现问题,并尝试了以下操作:
-如该问题的解决方案中所述,我修改了我的 AppDelegate.m 文件。
- 完成此操作后,在 index.html 文件(由 PhoneGap 创建)的一部分中,我有以下代码:
window.location("http://google.com");
虽然项目编译和构建良好,但我只看到一个空白页面。
我将不胜感激任何帮助,谢谢。
I'm trying to display a page, for example, www.google.com, in a PhoneGap application. However, I can't get the page to open in Safari, much less within PhoneGap (which is my ultimate goal).
I saw this post: PhoneGap for iPhone: problem loading external URL, and have tried from it the following:
-As described in the solution to that question, I have modified my AppDelegate.m file.
-After doing this, in part of the index.html file (created by PhoneGap), I have this code:
window.location("http://google.com");
Although the project compiles and builds fine, I see only a blank page.
I would appreciate any help, thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不是有效的 JavaScript。您需要:
或
isn't valid JavaScript. You need:
or
使用 .href 并查看此帖子,了解有关 PhoneGap 和外部 URL 的更多信息:PhoneGap for iPhone:加载外部 URL 时出现问题
Use .href and check this post for more information about PhoneGap and external URL: PhoneGap for iPhone: problem loading external URL
你需要的是 MainViewController.m 中的这个魅力,它适用于cordova 1.7.0 cordova 1.9.0 和 cordova 2.1.0
What you need is this charmer in your MainViewController.m It works for me in cordova 1.7.0 cordova 1.9.0 and cordova 2.1.0