2015-05-24 66 views
-2

这是我的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()); 
    }); 
}); 

和错误是它只是不工作,我不知道为什么?!我希望有人能帮帮忙!谢谢。

+0

内容脚本,而不是后台脚本。 – lifetimes

+0

@dsg只需将背景更改为内容?我不擅长这个谷歌Chrome扩展的东西呢。这是我的第一个。 –

+0

请花些时间阅读[体系结构概述](https://developer.chrome.com/extensions/overview#arch)。 – Xan

回答

0

我认为你必须使用的内容脚本的权限一样

"content_scripts": [ 
    { 
     "matches": ["http://www.google.co.in/*", 
     "https://www.google.co.in/*"], 
     "js": ["myscript.js"] 
    } 
    ] 
} 

,而不是背景详见H ttps://developer.chrome.com/extensions/content_scripts

+0

ahhh非常感谢你! –