I am currently developing a toolbar from Google Chrome. This is basically a toolbar that I insert into each web page using Content-Script. Technically, the toolbar is a materialized iframe that includes all components, such as a button, dropMenu, ... Here is the script you do this:
document.getElementsByTagName('body')[0].style.marginTop = '39px';
var body = $('body'),
toolbarURL = chrome.extension.getURL("yourtoolbar.html"),
iframe = $('<iframe id="YourToolbarFrame" scrolling="no" src="'+toolbarURL+'">');
body.append(iframe);
$("#YourToolbarFrame").hide().fadeIn(800);
But right now I'm trying to add some kind of component to this iframe, for example a button, but this did not work ...
var yt = $("#YourToolbarFrame");
var newButton = $('<a href="javascript:openInstantMessage()"><input type="image" src="images/pop.ico" name="InstantMessage" width="23" height="23"></a>');
yt.append(newButton);
The iframe body looks like this:
<body>
<div class="default">
// COMPONENTS
</div>
</body>
Hope someone can help me! :)
source
share