【发布时间】:2011-08-11 13:39:35
【问题描述】:
我怎样才能做到这一点?我已经阅读了文档,但我发现我只能have icon, a tooltip, a badge, and a popup。我想让它成为一个类似 StumbleUpon 的工具栏。然后我考虑使用 ContentScripts 但我不知道在哪里添加要注入的 html 因为根据to the documentation 我只有 js 或 css 的选项。我在这里错过了什么?
我有一个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>
栏出现了,但“你好”却不见了 =/
【问题讨论】:
标签: google-chrome-extension toolbar