我正在尝试进入Chrome扩展程序的神奇世界.现在我已经构建了我的清单,试图加载jquery.
{
"name": "Test Extension",
"version": "0.1",
"manifest_version": 2,
"description": "First try",
"options_page": "options.html",
"content_scripts": [{
"matches": ["chrome-extension://*/*"],
"js": ["jquery.js", "popup.js"],
"run_at": "document_end"
}],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html",
"default_title": "Click me!"
}
}
Run Code Online (Sandbox Code Playgroud)
实际上尝试重新加载扩展名告诉我"匹配"与有效架构不匹配.
但那还不是全部.为了克服它,我尝试只更改"匹配"值*://*/*并重新加载.好吧,扩展似乎加载正确,但似乎没有加载jquery由于我可以从popup.js得到的错误,只是告诉我
未捕获的ReferenceError:$未定义
实际上HTML只是:
<!doctype html>
<html>
<head>
<title>Test Extension</title>
<link rel="stylesheet" style="text/css" src="style.css">
</head>
<body>
<div id="test"></div>
</body>
</html>
<script type="text/javascript" src="popup.js"></script>
Run Code Online (Sandbox Code Playgroud)
popup.js代码就是这样做的:
$("#test").html("Foo!");
Run Code Online (Sandbox Code Playgroud) 我正在为我们部门创建一些网络应用程序.该部门是更大内部网的一部分,当然为更多部门提供服务.
我在一台从未使用过的PC上设置了WAMP环境,并开发了一些在该部门内部使用的简单应用程序.
对于每个应用程序,我都创建了一个别名,以及一种"主页",您可以在其中查看Web应用程序的"索引".
现在我要设置apache以拒绝访问除IP列表之外的各种Web应用程序.
我已经尝试使用authz_host来完成此操作,但它不起作用.
遵循Web应用程序Alias的copypaste.
Alias /national-alerts/ "c:/wamp/www/national-alerts/"
<Directory "c:/wamp/www/national-alerts/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order deny,allow
Deny from all
Allow from 10.176.164.53
Allow from 10.176.162.144
Allow from 10.176.162.219
Allow from 10.176.160.202
Allow from 10.176.165.143
Allow from 10.176.162.209
Allow from 10.176.166.46
Allow from 10.176.162.119
Allow from 10.176.160.232
Allow from 10.176.162.53
Allow from 10.176.164.33
Allow from 10.176.161.185
Allow from 10.176.162.111
</Directory>
Run Code Online (Sandbox Code Playgroud)
所有这些IP都来自内部网的内部IP.因此,任何访问都会获得"拒绝访问",因为Allow已被完全忽略.
有人可以帮助我指出正确的示例/文档吗?
我实际上正在开发我的第一个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