When the user clicks a button on the Firefox toolbar, I need to change the content of the currently active html page. In the standard version, it looks like this:
function injectNewContent() {
var pageHtml =
[
"<html>",
"<head>",
"</head>",
"<frameset cols='270,*' frameborder='0'>",
"<frame name='frameI' src='http://www.123.com/default.html'>",
"<frame name='frameII' src='" + document.location + "'>",
"<noframes>",
"<body>",
"noframes",
"</body>",
"</noframes>",
"</frameset>",
"</html>"
];
var fullPageHtml = "";
for (var i in pageHtml)
{
fullPageHtml += pageHtml[i];
}
window.document.write(fullPageHtml);
}
What do I need to change in this code to get the same functionality?
var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1'].
getService(Components.interfaces.nsIWindowMediator);
var recentWindow = windowMediator.getMostRecentWindow("navigator:browser");
recentWindow. ???
Or maybe I'm something wrong?
Thanks for any help ...
source
share