我实际上正在开发我的第一个Chrome扩展程序,即使它运行顺利,我从get()我用来检索一些数据的函数和代码安全性的烦人错误中得到了很多错误.
以下是涉及的代码:
<!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)
此脚本开始创建$.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