Javascript 在Firefox OS验证程序中检测到CSP冲突
我在firefox os验证程序中有这样一条消息: 错误:您的代码可能正在执行违反特权应用程序的CSP(内容安全策略)的操作。 您可以在Mozilla开发者网站上找到CSP允许和不允许的更多信息Javascript 在Firefox OS验证程序中检测到CSP冲突,javascript,firefox,firefox-os,Javascript,Firefox,Firefox Os,我在firefox os验证程序中有这样一条消息: 错误:您的代码可能正在执行违反特权应用程序的CSP(内容安全策略)的操作。 您可以在Mozilla开发者网站上找到CSP允许和不允许的更多信息 www/index.html 16 17 代码index.html: <!DOCTYPE html> <html> <head> <title>Chri App</title> <meta name="viewport
www/index.html
16
17
代码index.html:
<!DOCTYPE html>
<html>
<head>
<title>Chri App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="js/jquery.css.min.css" rel="stylesheet"/>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery.mobile-1.3.1.min.js"></script>
<meta charset='utf-8'>
<meta name="format-detection" content="telephone=no" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="js/select2/select2.css" rel="stylesheet" >
<link href="css/web_app.css" rel="stylesheet" >
<script src="main.js"></script>
<script type="text/javascript" src="js/select2/select2.js"></script>
<script>
$(document).bind('pageinit',function(e ){
$.support.cors = true;
$.mobile.allowCrossDomainPages= true;
$.mobile.selectmenu.prototype.options.nativeMenu = false;
// When the testform is submitted
$("#search-form-location").select2();
$("#search-form-category").select2();
$("#testform").submit(function() {
$.mobile.loading('show');
.......
Chri应用程序
$(document).bind('pageinit',函数(e){
$.support.cors=true;
$.mobile.allowCrossDomainPages=true;
$.mobile.selectmenu.prototype.options.nativeMenu=false;
//提交testform时
$(“#搜索表单位置”)。选择2();
$(“#搜索表单类别”)。选择2();
$(“#testform”).submit(函数(){
$.mobile.load('show');
.......
你有什么想法吗?如果你写的是特权(或认证)证书应用程序中,它需要遵守几个要求,以使其更加健壮-不易受到不同类型的攻击。限制之一禁止内嵌javascript,即嵌入在
标记中的javascript-您应该将这些内嵌脚本放在外部.js
文件中,并通过<代码>src属性
查看您的代码,这应该是验证器抱怨的原因(请参阅jQuery$(文档).bind(…
您在那里的块)。将此块放入外部文件应该可以解决这个问题
您可以阅读更多有关CSP的其他要求和限制。我们不是心灵感应。您需要显示您的代码。好的。我更改了问题
<!DOCTYPE html>
<html>
<head>
<title>Chri App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="js/jquery.css.min.css" rel="stylesheet"/>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery.mobile-1.3.1.min.js"></script>
<meta charset='utf-8'>
<meta name="format-detection" content="telephone=no" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="js/select2/select2.css" rel="stylesheet" >
<link href="css/web_app.css" rel="stylesheet" >
<script src="main.js"></script>
<script type="text/javascript" src="js/select2/select2.js"></script>
<script>
$(document).bind('pageinit',function(e ){
$.support.cors = true;
$.mobile.allowCrossDomainPages= true;
$.mobile.selectmenu.prototype.options.nativeMenu = false;
// When the testform is submitted
$("#search-form-location").select2();
$("#search-form-category").select2();
$("#testform").submit(function() {
$.mobile.loading('show');
.......