自從昨天以來,我一直在對抗科爾多瓦應用程序(iOS和Android)中的這個奇怪問題,所以我認爲是時候要求一點幫助。InAppBrowser.open with「_system」param在webview內部打開鏈接(僅適用於iOS)
我對 「deviceready」 事件運行下面的代碼:
document.addEventListener('deviceready', function() {
delete window.open;
$(document).on('mousedown','a', function(e) {
e.preventDefault();
if (this.hostname !== window.location.hostname) {
const url = $(this).attr('href');
cordova.InAppBrowser.open(url, '_system', 'location=yes');
}
});
}, false);
這是Android可以正常使用。在iOS中,它打開系統瀏覽器中的鏈接,當我回到我的應用程序時,它也在那裏打開。