Ich baue eine App mit Cordova. Ich verwende phonegap serve
, um die App mit phonegap Entwickler-App zu laden.Phonegap App Content-Security-Policy
In index.html
:
<meta http-equiv="Content-Security-Policy" content="default-src gap: file: tel: *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *">
(ich auch ohne file: tel:
habe versucht, das Ergebnis ist das gleiche)
Ich kann überprüfen, ob diese korrekt in platforms/browser/www/index.html
vorbereitet
Dann öffne ich phonegap App in iPad, ich laufe phonegap serve
, ich öffne Safari Entwicklungstools, drücken Sie verbinden und dort ist es:
Refused to load gap://ready because it appears in neither the child-src directive nor the default-src directive of the Content Security Policy.
In index.html
kann ich sehen, dass die Richtlinie auf umgewandelt wurde:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">
Gibt es eine Möglichkeit ipad zu machen, die Richtlinie korrekt zu laden?
EDIT
Ich habe auch versucht phonegap App-Entwickler mit CSP-Direktive in index.html
, Ergebnis ist das gleiche
EDIT zu kompilieren - 1
Ich habe auch die heruntergeladen Zip-Datei von http://192.168.1.130:3200/__api__/appzip
(hier habe ich meine phonegap serve
Server) und index.html
ist bereits transformiert!
Das seltsame hier ist, dass platforms/browser/www/index.html
nicht transformiert wird, so gibt es einige Prozesse dazwischen, die die CSP transformiert.
In meinem config.xml
Ich habe diese Richtlinien:
<content src="index.html" />
<access origin="*" />
<access origin="cdvfile://*" />
<access launch-external="yes" origin="tel:*" />
<!-- Allowed WebView navigations -->
<allow-navigation href="http://*"/>
<allow-navigation href="https://*"/>
<allow-navigation href="http://*/*"/>
<allow-navigation href="https://*/*"/>
<allow-navigation href="data:*"/>
<allow-navigation href="about:*"/>
<allow-navigation href="tel:*"/>
<allow-navigation href="gap:*" />
<!-- Allowed URLs to be opened from the app -->
<allow-intent href="http://*"/>
<allow-intent href="https://*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="geo:*"/>
<allow-intent href="cdvfile://*" />
Haben Sie irgendwelche Plugins? Vielleicht überschreiben einige der Plugins das Meta-Tag. –