如何才能做到这一点?我已阅读文档,但我发现我只能使用have icon, a tooltip, a badge, and a popup。我想让它成为一个类似StumbleUpon的工具栏。然后我想到了使用ContentScripts,但我不知道在哪里添加html注入,因为根据to the documentation我只有js或css的选项。我在这里错过了什么?为Chrome创建一个类似StumbleUpon的工具栏
我有一个js文件:
$("body").before('<div name="extension-top" id="extension-top"></div>');
var top = document.getElementById("extension-top");
document.getElementsByTagName('body')[0].style.marginTop = '40px';
top.src = chrome.extension.getURL("popup.html");
和css:
#extension-top { width:100%; height:40px; top:0; left:0; background:#000;margin:0;padding:0;}
最后一个html:
<body id="extension-content">
HELLO
</body>
酒吧显示出来,但 “你好” 是不是任何地方都可以看到=/
一个iframe肯定是要走的路。否则,你将有一个糟糕的时间来设计你的工具栏,而不会影响你正在注入的页面的CSS并受其影响。 –