[Javascript] capturing changes to the fragment identifier

John Zabroski johnzabroski at yahoo.com
Fri May 30 13:08:24 CDT 2008



Paul Novitski <paul at juniperwebcraft.com> wrote:One approach might be to apply onclick and onkeypress events to all 
anchors with hrefs containing fragment identifiers, and then process 
the changes to the hash with one central function when any of the 
links is activated.


This approach doesn't preserve the browser's navigation and bookmark state-process scheme, though.  Rule 1 for me is Don't Break The Browser.

If you go to http://www.example.com/mail#inbox, load the page and then edit the url in the location bar to http://www.example.com/mail#starred and hit enter, nothing will happen.  onclick and onkeypress is the wrong granularity for this.

       


More information about the Javascript mailing list