I am creating a Firefox Extension...what would be the javascript to open a URL in the current tab from a menuitem?
e.g. in my overlay.xul file i have the following line:
Call this JS functions on your commmand
//open a url current window:
function openUrl(url) {
content.wrappedJSObject.location = url;
newTabBrowser = gBrowser.selectedBrowser;
newTabBrowser.addEventListener("load", highlight, true);
}
//new tab
function openUrlNewTab(url) {
var win = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow('navigator:browser');
win.gBrowser.selectedTab = win.gBrowser.addTab(url);
}