gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 13:59:54 26 4
gpt4 key购买 nike

我想在我的 iOS phonegap 应用中只有一个 View 。

这个 View 将是一个网页。

我怎样才能用特定的 url 加载这个唯一的 View ?

我想你是通过 javascript 做的,如果是的话,怎么做?

*我不是 html/javascript 脚本编写者,我只开发 native iOS 应用程序,但我需要使用 phonegap 进行测试。

最佳答案

d0nparalias,

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

    <content src="index.html" />



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

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

  2. 如果您想在加载应用后立即打开网站,可以使用 InAppBrowser正如您已经注意到的那样。

    window.open(url, target, options);

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

    2.1。 _self你会得到类似
    enter image description here 的东西
    请注意,您没有任何控件可以返回到您的index.html。在这种情况下。

    2.2。 _blank — 呈现带有关闭按钮的模态视图 Controller
    enter image description here

    2.3。 _system — 在 Safari.app 中打开
    enter image description here

欲了解更多信息,请访问 documentationwiki .

希望对您有所帮助。

BR.
尤金

关于javascript - 如何使用 phonegap 在 iOS 应用程序中打开网页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15298737/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com