html5 使用 Content-Security-Policy 安全策略 导致ios10 与js 交互的代码不执行 自己的js代码正常
我的设置如下:
ios10 的脚本一直注入失败 (ios 端交互方式使用的是 WebViewJavascriptBridge )
无法执行ios 方法
ios 与 js 交互代码使用如下方式:
function setupWebViewJavascriptBridge(callback) {
if (Platform == "ios") {
if (window.WebViewJavascriptBridge) {
return callback(WebViewJavascriptBridge);
}
if (window.WVJBCallbacks) {
return window.WVJBCallbacks.push(callback);
}
window.WVJBCallbacks = [callback];
var WVJBIframe = document.createElement('iframe');
WVJBIframe.style.display = 'none';
WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
document.documentElement.appendChild(WVJBIframe);
setTimeout(function () {
document.documentElement.removeChild(WVJBIframe)
}, 0)
}
}
大神求指点,该怎么设置?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
欢迎选择我的课程,让我们一起见证您的进步~~