我使用这个元标记为CSP-获取文件预检问题:///科尔多瓦应用
<meta http-equiv="Content-Security-Policy" content="default-src * gap: file:; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src * 'unsafe-inline' 'unsafe-eval' ws: wss:;">
并试图获得本地HTML那么它不加载时。 在控制台也显示错误。
[Error] Failed to load resource: Preflight response is not successful (login.html, line 0)
[Error] XMLHttpRequest cannot load file:///Users/.../Library/Developer/CoreSimulator/Devices/.../data/Containers/Bundle/Application/.../test.app/www/templates/login.html. Preflight response is not successful
success (backbone.js:487)
l (jquery-2.0.2.min.js:5:24887)
fireWith (jquery-2.0.2.min.js:5:25704)
k (jquery-2.0.2.min.js:7:4931)
(anonymous function) (jquery-2.0.2.min.js:7:8725)
使用此代码来获取本地HTML(使用骨干) -
$.get('./templates/login.html', function(data) {
template = _.template(data);
_this.$el.append(template);
});
之前更新上面的代码是工作的罚款。我更新iOS和科尔多瓦最新,然后我得到这个问题。
有什么建议吗? //网址不允许:
你使用的是WKWebView插件吗? – connor
yes - cordova-plugin-wkwebview-engine 1.1.3 – San007