[Javascript] window location hash

Glenn E. Lanier, II glenn_lanier at netzero.net
Thu Mar 22 10:39:52 CDT 2007


	From: Guillaume
	Sent: Thursday, March 22, 2007 9:37 AM

	I'm experiencing a problem with:
	
	 window.location.hash = "bottomPage";
	
	It's buggy in Safari...
	
	The problem is known as the Safari location.hash reload bug and has
been documented by Mark "Tarquin" Wilton-Jones... Read below a cut and paste
describing the problem and the solution
(http://www.howtocreate.co.uk/safari/locationHashBug.html).
	...
	

	What is going on here?


	Setting location.hash to the same value twice in a row causes Safari
to reload the page. Tested in Safari 1.1-1.2 and equivalent OmniWeb
versions.


	What can be done to workaround this bug?


	Don't set location.href to the same value twice in a row. If needed,
set it to an intermediate value in between.

	...
	
	Anyone having an idea on how to apply this workaround to the code
mentioned before.
	

Untested, but would

var hashValue = "bottomPage";
if (hashValue != window.location.hash)
{
	window.location.hash = hashValue;
}

work?

--G




More information about the Javascript mailing list