Y
Yimin Rong
The reference I have says that hash is a read/write string that
specifies the anchor portion of the current URL, including the leading
"#". So, for example:
location.hash = "#intro";
Would move to the "intro" section of the current document. I've found
that the above code doesn't work in some browsers, in particular
Netscape 4.X for Windows, and almost all IE & Netscape for Macintosh
OS9 and OSX.
I looked around and the 'correct' code to use for many of those
browsers seems to exclude the leading "#":
location.hash = "intro";
Some questions:
Is there a way to find out in client-side JavaScript which convention
a browser/OS combination uses? (Preferably something that doesn't use
the user agent string.)
If not, if I omit the leading "#" as a default, will it run into
problems with the newer browsers? (If I had to choose, my choice is to
move forward with the new compliant browsers.)
Thanks for reading,
Yimin Rong
specifies the anchor portion of the current URL, including the leading
"#". So, for example:
location.hash = "#intro";
Would move to the "intro" section of the current document. I've found
that the above code doesn't work in some browsers, in particular
Netscape 4.X for Windows, and almost all IE & Netscape for Macintosh
OS9 and OSX.
I looked around and the 'correct' code to use for many of those
browsers seems to exclude the leading "#":
location.hash = "intro";
Some questions:
Is there a way to find out in client-side JavaScript which convention
a browser/OS combination uses? (Preferably something that doesn't use
the user agent string.)
If not, if I omit the leading "#" as a default, will it run into
problems with the newer browsers? (If I had to choose, my choice is to
move forward with the new compliant browsers.)
Thanks for reading,
Yimin Rong