How to change the current URL in an XUL file ?

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.

Doubt in XUL

Doubt in XUL


2 responses to “How to change the current URL in an XUL file ?

  1. Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

  2. Sign: zdbrw Hello!!! tghym and 1332vggumkvnrt and 8279 : Sorry, what did you mean?? A??

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s