Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

How to get window.location.hash to work in Fire Fox?

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm using window.location.hash to forward the user to a certain part of the HTML page. Works well in IE but not in Fire Fox (2.0.0.8).

I used the forum search but only found a post where no solution existed:
https://coderanch.com/t/116194/HTML-JavaScript/window-location-hash

Does anyone know a solution to this?

cheers,
Pete
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Works fine in FF 2.0.0.8 for me. What exactly are you doing? Are there any messages in the Error Console?
 
Pete Neu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hm, just played around with problem and found out that IE has the peculiarity that it loads & executes this code when the page is loaded.

Firefox seems to refuse to do this and wants a tweaking like this:


I suppose this won't work any other way, right?
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my test I didn't put the "#" in front of the hash name. Try if it works without it.

Firefox executes the code that you put directly into the script tag, but probably at a time when that hash mark doesn't exist, because the page hasn't been rendered yet.
[ October 22, 2007: Message edited by: Ulf Dittmer ]
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic