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/Sor...scription.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/Sor...scription.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?
-- http://www.standards.com/; See Howard Kaikow's web site. 12 1778
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.
"Lee" <RE**************@cox.net> wrote in message
news:co*********@drn.newsguy.com... 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?
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.
--
Rob
XXX was just a placeholder in my posting. I stated:
"For example, use IE and Firefox with the links in
http://www.standards.com/test-links-global.html."
-- http://www.standards.com/; See Howard Kaikow's web site.
"RobG" <rg***@iinet.net.auau> wrote in message
news:sk*****************@news.optus.net.au... 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.
-- Rob
I now see what is happening that is different between IE and Firefox.
For example, using a URL of the form http://www.standards.com/index.html#XXX
m where XXX is any of the 41 values that I specify in my javascript, IE
does what I intended and takes the user to the correct page. Where XXX is
"Standards: or "Temporary" or "ThisandThat", the target document is actually
index.html itself.
IE handles all 41 cases as I intended, however, for the three targets that
are actually in index.html, Firefox causes the script to be called a second
time. The code looks like it is running correctly each time, i.e., it
executes the following statement.
location.replace(URLList[locSearch]);
Somehow, the 2nd pass thru the script using Firefox is causing a problem for
those three cases.
You can see the behavior by using IE and Firefox with the links in http://www.standards.com/test-links-global.html.
Here's a corrected version of my previous message, i.e., less typos.
--------------
I now see what is happening that is different between IE and Firefox.
For example, using a URL of the form http://www.standards.com/index.html#XXX,
where XXX is any of the 41 values that I specify in my javascript, IE
does what I intended and takes the user to the correct page. Where XXX is
"Standards" or "Temporary" or "ThisandThat", the target document is actually
index.html itself.
IE handles all 41 cases as I intended, however, for the three targets that
are actually in index.html, Firefox causes the script to be called a second
time. The code looks like it is running correctly each time, i.e., it
executes the following statement.
location.replace(URLList[locSearch]);
Somehow, the 2nd pass thru the script using Firefox is causing a problem for
those three cases.
You can see the behavior by using IE and Firefox with the links in http://www.standards.com/test-links-global.html.
JRS: In article <co*********@drn.newsguy.com>, dated Sun, 28 Nov 2004
13:01:02, seen in news:comp.lang.javascript, Lee
<RE**************@cox.net> posted : 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.
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.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; Win98. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
The anchor does exist.
-- http://www.standards.com/; See Howard Kaikow's web site.
"Dr John Stockton" <sp**@merlyn.demon.co.uk> wrote in message
news:+r**************@merlyn.demon.co.uk... JRS: In article <co*********@drn.newsguy.com>, dated Sun, 28 Nov 2004 13:01:02, seen in news:comp.lang.javascript, Lee <RE**************@cox.net> posted :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.
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.
-- © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20;
Win98. © Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms &
links. PAS EXE TXT ZIP via
<URL:http://www.merlyn.demon.co.uk/programs/00index.htm> My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also
batprogs.htm.
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.
-- http://www.standards.com/; See Howard Kaikow's web site.
"Howard Kaikow" <ka****@standards.com> wrote in message
news:co**********@pyrite.mv.net... 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/Sor...scription.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/Sor...scription.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? -- http://www.standards.com/; See Howard Kaikow's web site.
JRS: In article <co**********@pyrite.mv.net>, dated Mon, 29 Nov 2004
14:43:21, seen in news:comp.lang.javascript, Howard Kaikow
<ka****@standards.com> posted : Lines: 47
The anchor does exist.
Do learn FAQ section 2.3, including the first part of para 6.
I was responding to Lee's post, not to anything that you wrote.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News. This discussion thread is closed Replies have been disabled for this discussion. Similar topics
5 posts
views
Thread by LRW |
last post: by
|
13 posts
views
Thread by John Smith |
last post: by
|
8 posts
views
Thread by chrisdude911 |
last post: by
|
4 posts
views
Thread by lmarceglia |
last post: by
|
7 posts
views
Thread by Coder |
last post: by
|
11 posts
views
Thread by minnesotti |
last post: by
|
8 posts
views
Thread by Matt Kruse |
last post: by
|
16 posts
views
Thread by Eric |
last post: by
|
12 posts
views
Thread by tim |
last post: by
| | | | | | | | | | |