Topics

XUL : open URL with a referrer

This is a small to use in which makes use of the parameter sent to loadURI() and addTab() functions


const REF_URI = Components.Constructor("@.org//standard-url;1", "nsIURI");
 REF =  REF_URI;
REF.spec = 'http://.com/';

function (url, openTab)
{
	if(openTab)
	{
         newTab = getBrowser().addTab(url, REF, null, null);
        getBrowser().selectedTab = newTab;
	}
	else
	{
		getBrowser().webNavigation.loadURI(url, Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE, REF, null, null);
	}
	
}