I came across this strange problem .
When I used this line of code
var currentURL = urls[z(0,totalurls-1)]; ;
window.location.href = currentURL;
where z is a function that returns the function randomly.
The code is working perfectly fine and changes the URL of the current window itself…but the problem here is that we can switch websites only once as the object that invokes the random change of URL disappears with the first site itself.
The solution is a Custom Toolbar which will not go away even if the URL is changed….Something like STUMBLE UPON..
So , when this same code is used in an XUL file, another window is being created with the random URL, but I want the random URL change to happen in the same window.It is creating one more window at each click of the Stumble button.