将铬插件移植到FIREFOX-CSP问题

时间:2020-04-28 17:29:22

标签: jquery google-chrome firefox

我需要将Chrome扩展程序移植到firefox。我成功测试了crx文件,并且在对manifest.json进行了细微调整之后,我在firefox上加载了。 在控制台日志上,我收到以下警报:

内容安全策略:页面的设置禁止在(“ script-src”)处加载资源。 jquery.min.js:4:4631。

插件正常工作,但是只有obe按钮有问题 管理按钮的脚本如下所示:

$('#idati').remove();
$('#chat').remove();
$('#linksalva').remove();

var framechat = $('body', $("frame[name='testo']", $("frame[name='result']")[0].contentDocument)[0].contentDocument);
var frameinfo = $("body", $("frame[name='logo']")[0].contentDocument);
var dati = frameinfo.html();
var salvadati = "<div id='idati' style='display:hidden;'>"+dati+"</div>";
$(salvadati).appendTo('body');

var nome = $("#idati input[name='player']").val();
var luogo = $("#idati input[name='titolo']").val();
luogo = luogo.replace("<b>", "").replace("</b>", "");
if (framechat) {
var info = framechat.html();
info = info.replace(/\&gt;/g, "»</i>").replace(/\&lt;/g,'<i>«');

var salvachat = "<div id='chat'><form id='salvataggio' name='salvataggio'><input type='hidden' name='pg' id='pg' value='"+nome+"' /><input type='hidden' name='luogo' id='luogo' value=\""+luogo+"\" /><textarea id='chat' name='chat'>"+info+"</textarea></form><div id='esito_salva'></div></div>";
$(salvachat).appendTo('head');

var url = "http://mysite.site.org/path/page.php";
var modulo = "#salvataggio"; 
var esito = "#esito_salva";
$.post( url, $(modulo).serialize()).done(function(data) { $(esito).html(data); } );

} 
}

php代码页面有对话框请求:

<div id='divsalvataggio'> Ora puoi scaricare la tua Giocata </br></br></br></br>

<button class="btn"><i class="fa fa-download"></i> <a href="http://mysite.site.org/path/<?=$link?>" <target="popup"  onclick="window.open('http://mysite.site.org/path/<?=$link?>','popup','width=100,height=100,scrollbars=no,resizable=no,location=no',setTimeout("window.close()",1000));return false;">Scarica Giocata</a></button></div>

<script>
$('#divsalvataggio').dialog({ title:'Chat Salvata', resizable: true, position: {  my: "center top",
  at: "center top", of: window }, 
        minHeight: 100, minWidth: 200,  height: 150, width:300, cache: false,
        open: function (event,ui) {ccc() },
        close: function(event, ui) { $(this).dialog("close"); $(this).remove(); } });

</script>

在chrome中正常工作,并出现对话框。

在Firefox NO。中,我不明白为什么。

0 个答案:

没有答案