Bug in my Javascript or bug in Firefox

H

Howard Kaikow

Yesterday, I decided to try Firefox. I've encountered a behavior that is
either a bug in Firefox or a bug in my Javascript code. I'll try to explain
the problem, hoping that this newsgroup can (in)validate my Javascript code.

First, I'll describe the purpose of the Javascript code.

I often have a need to post a URL to something at my own web site, e.g.,
http://www.standards.com/Sorting/SortPerformanceComparison-Description.html.
It is not easy to remember, or type without error, each URL, so I decided to
write my first Javascript to be able to use
http://www.standards.com/index.html?Sorting instead, which ends up going to
http://www.standards.com/Sorting/SortPerformanceComparison-Description.html.

I then decided, perhaps for no good reason, to also allow
http://www.standards.com/index.html#Sorting to mean the same as
http://www.standards.com/index.html?Sorting. Of course, this works only if
Javascript is enabled. To provide for those not having Javascript enabled,
e.g., http://www.standards.com/index.html#Sorting will go to an anchor that
links to a list of non-Javascript links.

All seemed to work well using IE, but about 35 hours ago, I impulsively
installed Firefox 1.0.

Firefox seems to have a problem if the Javascript resolves, e.g.,
http://www.standards.com/index.html#XXX to actually be
http://www.standards.com/index.html#XXX, whilst IE has no problems. For
example, use IE and Firefox with the links in
http://www.standards.com/test-links-global.html.

Is this a Firefox bug?
Or am I doing something wrong in the Javascript in
http://www.standards.com/links-index.js.
If the latter, how can the Javascript be corrected with a client side
solution?
 
L

Lee

Howard Kaikow said:
Yesterday, I decided to try Firefox. I've encountered a behavior that is
either a bug in Firefox or a bug in my Javascript code.

If you give Firefox an URL that doesn't exist, it will complain
and refuse the load it. That doesn't seem unreasonable, to me.

IE, apparently, will silently load the wrong address (the top of
the page, ignoring the anchor specification).

I don't see that as either a bug in Firefox or in your code.

The problem sems to be that your design relies upon a quirk of IE
that is not shared by Firefox.
 
H

Howard Kaikow

Lee said:
If you give Firefox an URL that doesn't exist, it will complain
and refuse the load it. That doesn't seem unreasonable, to me.

Yes, but the URL that is causing problems does exist, i.e., the anchor is in
the index.html file.
IE, apparently, will silently load the wrong address (the top of
the page, ignoring the anchor specification).

I don't see that as either a bug in Firefox or in your code.

The problem sems to be that your design relies upon a quirk of IE
that is not shared by Firefox.
If I cannot rely on Bill Gates, who can I rely on?
 
R

RobG

Howard Kaikow wrote:
[...]
If I cannot rely on Bill Gates, who can I rely on?

If I click on your link:

<URL:http://www.standards.com/index.html#XXX>

in Firefox 1.0, I am given an error prompt that the URL doesn't exist,
then I'm taken to:

<URL:http://www.standards.com/index-js.html>

IE does exactly the same thing. If that is your expected behaviour,
then there is no issue regarding a difference in how IE or Firefox
treat URLs with invalid anchors.
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Sun, 28 Nov 2004
13:01:02, seen in Lee
Howard Kaikow said:

Description was not reliably understood.

If you give Firefox an URL that doesn't exist, it will complain
and refuse the load it. That doesn't seem unreasonable, to me.

IE, apparently, will silently load the wrong address (the top of
the page, ignoring the anchor specification).

A browser can only determine that an anchor does not exist by fetching
and examining the whole page. After fetching the whole page, ISTM
reasonable to show it; after all, there's a good chance of it's being
wanted. One would like to see a warning that the anchor was specified
but not found, though.
I don't see that as either a bug in Firefox or in your code.

The problem sems to be that your design relies upon a quirk of IE
that is not shared by Firefox.

ISTM bad Firefox design.
 
H

Howard Kaikow

The anchor does exist.

--
http://www.standards.com/; See Howard Kaikow's web site.
Dr John Stockton said:
JRS: In article <[email protected]>, dated Sun, 28 Nov 2004
13:01:02, seen in Lee


Description was not reliably understood.



A browser can only determine that an anchor does not exist by fetching
and examining the whole page. After fetching the whole page, ISTM
reasonable to show it; after all, there's a good chance of it's being
wanted. One would like to see a warning that the anchor was specified
but not found, though.


ISTM bad Firefox design.
batprogs.htm.
 
H

Howard Kaikow

I have managed to rewrite the script to avoid the problem with Firefox.

This does not explain why Firefox behaved differently than IE and Safari.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top