我有一个phonegap应用程序,我已经采取了所有措施
<access origin="*://*.mysite/*" subdomains="true" />
<access origin="*://*.gstatic.com/*" subdomains="true" />
<access origin="*://*.google.com/*" subdomains="true" />
<access origin="*://*.googleusercontent.com/*" subdomains="true" />
当我的数据信用到期时,我会被重定向到 ISP 远程页面,这是我不想要的。
如果信用过期,我如何修改我的配置文件或索引页以避免重定向或重定向到内部源。
最佳答案
<meta http-equiv="Content-Security-Policy" content="default-src 'self' http://*.myweb http://myweb/tribes/shopmobile.php data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline';style-src 'self'https://fonts.googleapis.com/icon?family=Material+Icons;img-src https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css 'self' http://myweb/ data:;script-src * 'unsafe-inline' 'unsafe-eval'; media-src *;style-src 'self' 'unsafe-inline'; img-src 'self' http://myweb data:;child-src 'self' https://www.youtube.com data:;frame-src *;">
我在我的应用程序上使用了上述 csp 允许内部链接 style-src 'self' 'unsafe-inline' - 允许外部和内部样式 script-src * 'unsafe-inline' 'unsafe-eval' - 允许所有js脚本 img-src' self 'http://myweb数据:允许来 self 的服务器的图像 content="default-src 'self' http://*.myweb http://myweb/tribes/shopmobile.php 数据:间隙:https://ssl.gstatic.com 仅允许来 self 的服务器的数据
上面的代码有效
关于javascript - 当信用到期时防止 ISP 重定向重定向到我的应用程序页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49104515/