【发布时间】:2015-08-05 19:21:46
【问题描述】:
这是在我的 manifest.json 中:
{
"manifest_version": 2,
"name": "ROBLOX Forum Link Fixer",
"description": "Fixes the amp; issue on the ROBLOX forum.",
"version": "2.0",
"background": {
"scripts": [
"jquery.js",
"fixer.js"
]
},
"permissions": [
"http://*.roblox.com/*",
"https://*.roblox.com/*"
]
}
这是在 fixer.js 内部(jquery.js 只是 jQuery):
$(document).ready(function(){
$('.rbx-link.user-link').each(function(){
$(this).text($(this).text().replace(/amp;/g, ""));
$(this).attr("href",$(this).text());
});
});
错误是它不起作用,我不知道为什么?!我希望有人能帮帮忙!谢谢。
【问题讨论】:
-
内容脚本,而不是后台脚本。
-
@dsg 所以只是将背景更改为内容?我还不擅长这个 google chrome 扩展的东西。这是我的第一个。
-
请花点时间阅读Architecture Overview。
标签: javascript json google-chrome google-chrome-extension