如何使用phonegap在iOS应用程序中打开网页?

2023-11-23

我只想在我的 iOS PhoneGap 应用程序中只有一个视图。

该视图将是一个网页。

我怎样才能用特定的网址加载这个唯一的视图?

我想你是通过 javascript 来做到这一点的,如果是的话,怎么做?

*我不是 html/javascript 脚本编写者,我只开发本机 iOS 应用程序,但我需要使用phonegap 测试一些东西。


d0nparalias,

  1. 如果你想加载 main(Cordova 的)index.html从远程服务器,编辑config.xml文件并更改

    <content src="index.html" />

    to

    <content src="http://192.168.1.4:8080/www/index.html" />

    例如。它会加载index.html来自位于 192.168.1.4 的 Web 服务器。

  2. 如果您想在加载应用程序后立即打开网站,您可以使用应用内浏览器正如你已经注意到的。

    window.open(url, target, options);

    在这里您可以选择target(根据 Cordova 文档 2.5.0):

    2.1. _self and you'll get something like
    enter image description here
    Note, that you don't have any controls to return to your index.html in this case.

    2.2. _blank — presents modal view controller with dismiss button
    enter image description here

    2.3. _system — opens in Safari.app
    enter image description here

欲了解更多信息,请访问文档 and wiki.

希望能帮助到你。

BR.
Eugene

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用phonegap在iOS应用程序中打开网页? 的相关文章

随机推荐