gpt4 book ai didi

ios - iOS Ionic 应用程序中的链接不会立即打开

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:54:48 25 4
gpt4 key购买 nike

我在我的应用程序的一个 View 中有几个链接:

  1. 分享
  2. 添加到日历
  3. 打开外部链接

在我用来测试应用程序的 iPhone 上,1 和 2 可以正常工作,但只有当我按下主页按钮然后返回到应用程序时,才会出现共享/日历对话框。任何人都可以提出可能导致这种情况的原因吗?我什至不确定去哪里看。

外部链接使用 window.open(url, "_system") 因为我无法获得在模拟器中工作的常规类型链接。我可能会切换回常规 HTML 链接,因为另一个链接能够在测试 iPhone 上工作。使用 iOS 在手机浏览器中打开链接的建议方法是什么?

代码大致如下。

.controller('WCtrl', function ($scope, $stateParams, $sce) {
// ...
$scope.doShare = function () {
var options = {
message: 'Message here',
subject: 'Event shared'
};
var onSuccess = function (result) {
console.log('Share successful.');
};
var onError = function (msg) {
console.log('Sharing failed with message: ' + msg);
}
window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);
};
$scope.doCalAdd = function () {
var onSuccess = function (result) {
console.log('Add to calendar successful.');
};
var onError = function (msg) {
console.log('Add to calendar failed with message: ' + msg);
}
// ...
window.plugins.calendar.createEventInteractively(
title,
location,
notes,
starttime,
endtime,
onSuccess,
onError);
};
$scope.doTicketsOpen = function () {
var url = w.ticketing;
window.open(url, '_system');
};
})
<ion-view class="item-text-wrap" view-title="Event Details">
<ion-content class="has-footer">
<!-- ... -->
</ion-content>
<ion-footer-bar>
<div class="button-bar">
<div class="button icon ion-share" ng-click="doShare();">Share</div>
<div class="button icon ion-calendar" ng-click="doCalAdd();">Calendar</div>
<div class="button icon ion-link" ng-click="doTicketsOpen();">Ticketing</div>
</div>
</ion-footer-bar>
</ion-view>

我在 index.html 中有一个 Content-Security-Policy 元标记,如下所示。

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'" />

最佳答案

您必须在 index 的 Content-Security-Policy 元标记的 default-src 中添加 gap: .html.

这是因为在 iOS 10 上 Apple 对 CSP 变得更加严格,* 没有涵盖某些内容

关于ios - iOS Ionic 应用程序中的链接不会立即打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43326912/

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