相关疑难解决方法(0)

控制台显示有关内容安全策略和许多失败的GET请求的错误

我实际上正在开发我的第一个Chrome扩展程序,即使它运行顺利,我从get()我用来检索一些数据的函数和代码安全性的烦人错误中得到了很多错误.

这是控制台日志屏幕截图: 控制台日志

以下是涉及的代码:

popup.html

<!doctype html>
<html>
<head>
    <title>NGI Little Helper - Subscribes</title>
    <link rel="stylesheet" href="popup.css">
    <!-- JavaScript and HTML must be in separate files for security. -->
    <script type="text/javascript" src="common/jquery.js"></script>
    <script type="text/javascript" src="popup.js"></script>
</head>

<body>
    <h1>Topics</h1>
    <div id="content">..:: Loading ::..</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

popup.js

此脚本开始创建$.get()远程网页.变量的内容data可以在这里找到

$.get("http://gaming.ngi.it/subscription.php?do=viewsubscription", function(data) {
    var TDs = $('td[id*="td_threadtitle_"]', data);
    $(document).ready(function() {
        $("#content").html("<br/>");
        $.each( TDs, function() {
            //Removes useless elements from the source …
Run Code Online (Sandbox Code Playgroud)

javascript dom google-chrome google-chrome-extension content-security-policy

3
推荐指数
1
解决办法
2480
查看次数