我在我的應用程序中嵌入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。
你有什麼想法?
在此先感謝球員。