location.hash javascript bug in Firefox 3.0

2. October 2009 13:02

After struggling for awhile trying to figure out a problem with resetting the URL hash (also called the URL fragment) in Javascript, I discovered a bug in Firefox 3.0.

When setting location.hash to en empty string in Firefox 3.0, it will cause a page reload. To solve, use location.hash = '#' instead. This will also work in all other major browsers. The issue appears only in Firefox version 3.0.* - it seems to have been fixed in 3.5.

This might be a useful point to remember if you are writing a lot of cross-browser Javascript.

Comments

5/31/2010 8:52:34 PM #

Grover Raiola

Very interesting information.keep em coming.

Grover Raiola United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Archive