为Chrome创建一个类似StumbleUpon的工具栏 [英] Creating a StumbleUpon-like toolbar for Chrome
问题描述
我有一个js文件:
(body)。before('< div name =extension-topid =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%;高度:40像素;顶部:0;左:0;背景:#000; margin:0; padding:0;}
最后一个html:
< body id =extension-content>
HELLO
< / body>
栏显示,但hello不在任何地方可见= /
有一个实验性的Infobar API,可以用来创建类似StumbleUpon的工具栏。有关文档和示例,请参阅 Infobars 。
请注意,在API稳定之前,您无法将扩展程序发布到Chrome网上应用店。
How can I get to do this? I've read the documentation but I find I can only have icon, a tooltip, a badge, and a popup. And I want to make it a StumbleUpon-like toolbar. Then I thought about using ContentScripts but I don't know where to add the html to inject because according to the documentation I only have the options of js or css. What am I missing here?
I have a js file:
$("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");
and css:
#extension-top { width:100%; height:40px; top:0; left:0; background:#000;margin:0;padding:0;}
finally an html:
<body id="extension-content">
HELLO
</body>
The bar shows up but the "hello" isn't anywhere to be seen =/
There is an experimental Infobar API that you could use to make a StumbleUpon-like toolbar. See Infobars for documentation and examples.
Note that you won't be able to publish the extension to the Chrome Web Store until the API becomes stable.
这篇关于为Chrome创建一个类似StumbleUpon的工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!