xcode Phonegap App : 外部 URL 不会在 IOS 的 InApp 浏览器中打开

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17569787/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:35:42  来源:igfitidea点击:

Phonegap App : External URL don't open in InApp Browser of IOS

iphoneiosxcodecordovainappbrowser

提问by Shashi

External URLs don't open in the system's browser in my PhoneGap IOS application. I'm using PhoneGap Build 2.7.0.

外部 URL 不会在我的 PhoneGap IOS 应用程序的系统浏览器中打开。我正在使用 PhoneGap Build 2.7.0。

Javascript:

Javascript:

window.open(myURL, '_blank', 'location=yes');

window.open(myURL, '_blank', 'location=yes');

Config.xml

配置文件

<plugins>
    <plugin name="InAppBrowser" value="CDVInAppBrowser" />
</plugins>

<access origin="*" />

How to solve this? when i using the url "www.google.com" it works fine but when i used required url for my app it did not worked even that url works fine in browser.

如何解决这个问题?当我使用网址“www.google.com”时,它工作正常,但是当我为我的应用程序使用所需的网址时,即使该网址在浏览器中工作正常,它也无法正常工作。

回答by Shashi

Javascript:

Javascript:

myURL = encodeURI(myURL);
window.open(myURL, '_blank', 'location=yes'); 

Using of encodeURI method fix the above issue

使用 encodeURI 方法解决上述问题

回答by MAST3RMIND

Take reference from thislink. I have used this plugin for my IOS application development way back. It works like a charm. Also, it is easy to integrate.

这个链接中获取参考。我已经在我的 IOS 应用程序开发中使用了这个插件。它就像一个魅力。此外,它易于集成。

Hope it helps !

希望能帮助到你 !