拒绝执行JavaScript URL,因为它违反了以下内容安全策略指令:

拒绝执行JavaScript URL,因为它违反了以下内容安全策略指令:,javascript,jquery,google-chrome-extension,Javascript,Jquery,Google Chrome Extension,在发布之前,我阅读了与标题相关的帖子,我确信我的问题有解决方案,但我是一个拥有扩展、JavaScript和JQuery的n00b,我不知道 导致拒绝的代码是: innerframe = $("<iframe/>").css({ top: WIDGET_TITLE_HEIGHT + "px", left: "0px", width: "100%", height: "1000px", border: "none", align: "cen

在发布之前,我阅读了与标题相关的帖子,我确信我的问题有解决方案,但我是一个拥有扩展、JavaScript和JQuery的n00b,我不知道

导致拒绝的代码是:

innerframe = $("<iframe/>").css({
    top: WIDGET_TITLE_HEIGHT + "px",
    left: "0px",
    width: "100%",
    height: "1000px",
    border: "none",
    align: "center",
    display: "block"})
.appendTo(innerdiv)
.load(function() {
    onStart()
})
.attr({
    frameBorder: 0,
    //scrolling:0,
    src: 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.write(\' <!DOCTYPE html>' + '\');document.close();})();'
})[0];
innerframe=$(“”).css({
顶部:小部件\标题\高度+“px”,
左:“0px”,
宽度:“100%”,
高度:“1000px”,
边界:“无”,
对齐:“居中”,
显示:“块”})
.appendTo(innerdiv)
.load(函数(){
onStart()
})
艾特先生({
帧边框:0,
//滚动:0,
src:'javascript:'function(){document.open();document.domain=“'+document.domain+'”;document.write(\'+'\');document.close();})(;'
})[0];
行src:'javascript…'是违规者,但我不知道解决方案是什么

我读过的帖子清楚地表明,该代码违反了Chrome的CSP,我也看到有人提到消息传递、沙箱等

我希望有人能提供一个解决方案,帮助我了解发生了什么


提前谢谢

您的脚本可能违反了,即脚本只能在来自同一域的页面上执行。具体来说,它们必须具有相同的协议和主机


你的行
document.write(\''+'\')
可能是罪魁祸首。

请发布完整的错误消息。以下是CSP的一些信息,