我在我的应用程序中嵌入GoogleMap。 在嵌入式地图(这是一个iFrame)我有谷歌链接:'term of use'。 当我点击链接(客户可能会错误地做到这一点),它会在我的应用程序和全屏幕中打开页面。不可能然后回到应用程序!PhoneGap /科尔多瓦开放外部链接到Safari而不是全屏inApp
所以我添加了Cordova Plugin InAppBrowser。我创建了一个小脚本来防止这种情况发生:
$("a").click(function(e) {
console.log("checking link");
var link = e.currentTarget.href;
var testURL = (link.indexOf("www") > (-1));
testURL |= (link.indexOf("http") > (-1));
testURL |= (link.indexOf(".com") > (-1));
testURL |= (link.indexOf(".fr") > (-1));
if (testURL) {/*if URL is external open in 'new window'*/
console.log("Prevent InApp URL FullScreen");
window.open(link, "_system");
}
});
而且它在页面上的经典链接上运行得非常好。 主要问题是谷歌地图是在一个iFrame!这样,我无法访问从jQuery的元素与$(“A”)。单击(.....)不工作的iFrame的链接!
,总结
我想任何外部链接(http,wwww,.fr,.com,.org等)在Safari中打开而不是我的应用程序或使用InAppBrowser插件在我的应用程序中打开但不是全屏,到App。
你有什么想法?
在此先感谢球员。