javascript - 在 PhoneGap 中调用 window.location.href 触发网络浏览器

标签 javascript ipad browser cordova window.location

你好 我正在尝试使用 PhoneGap 为 iPad 开发应用程序。我想在 index.html 页面内动态加载外部网站的主页。 不幸的是使用

window.location.href = "http://mywebsite.com/cgi-bin/index.py"

触发 Safari 窗口的打开而不是使用 PhoneGap 容器。

有什么建议吗?

非常感谢

子句

最佳答案

还有一个更简单的选择:修改config.xml

Open all links in WebView

stay-in-webview with values true or false

  • example: <preference name="stay-in-webview" value="true" />

  • if set to true, all links (even with target set to blank) will open in the app's webview

  • only use this preference if you want pages from your server to take over your entire app

  • default is false

来源:https://build.phonegap.com/docs/config-xml

关于javascript - 在 PhoneGap 中调用 window.location.href 触发网络浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5897955/

相关文章:

iphone - 如何在 iOS(iPhone、iPad)项目中使用 CARingBuffer 类?

iphone - 播放 : Playing a Movie from MPMoviePlayerController results in only audio being streamed to Apple tv

javascript - 安全 - 将数据从第三方发送到我的服务器 Ajax php

ios - 查看方向变化

javascript - 在 EmberJS 中嵌套资源

google-maps - 在 IE 中嵌入谷歌地图

android - 在 chrome 的最后一个打开的选项卡中打开 url

apache-flex - 开发在线考试应用程序,如何防止作弊?

java - 执行 php 文件从 SQL 数据库获取信息时如何上传数据用作过滤器?

JavaScript 调用 AS3 函数