gpt4 book ai didi

ios - Cordova - window.open 不适用于 IOS

转载 作者:行者123 更新时间:2023-11-29 05:18:22 25 4
gpt4 key购买 nike

当我使用时,我无法在 IOS 上的 cordova 应用程序中打开链接

window.open('http://maps.apple.com/?q='+label, '_system');

但它适用于(但不适用于浏览器):

window.location.href = 'http://maps.apple.com/?q='+label;

在我的 config.xml 中,我将其列入白名单:

<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

在我的index.html中:

<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: content:">

我真的不明白这个问题..

谢谢

最佳答案

在我的 iOS Cordova 应用程序中,window.open() 仅当事件与触摸相关时才起作用,而不是与 onDeviceReady() 或 setTimeout() 等自动事件相关。

在 onclick() 事件之后执行 window.open 工作正常。

关于ios - Cordova - window.open 不适用于 IOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58944825/

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