473,486 Members | 2,131 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Bug in my Javascript or bug in Firefox

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.

Jul 23 '05 #1
12 1910
Howard Kaikow wrote:
[snip]
http://www.standards.com/index.html#Sorting
http://www.standards.com/index.html?


Perhaps?
http://www.standards.com/index.html#Sorting?Sorting
Rename your anchor "Sorting?Sorting"
Be sure to parse out "#Sorting" for your js browsers,
Mick
Jul 23 '05 #2
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.

Jul 23 '05 #3
"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?
Jul 23 '05 #4
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
Jul 23 '05 #5
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

Jul 23 '05 #6
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.
Jul 23 '05 #7
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.
Jul 23 '05 #8
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.
Jul 23 '05 #9
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.
Jul 23 '05 #10
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.

Jul 23 '05 #11
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.
Jul 23 '05 #12
Interested, or not, parties may follow the soap opera at
https://bugzilla.mozilla.org/show_bug.cgi?id=272126.

I've encountered two differences between IE and Firefox related to this
thread and have posted a PDF at
https://bugzilla.mozilla.org/show_bug.cgi?id=272126 describing how to
reproduce the behavior.
Jul 23 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2200
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine...
13
8270
by: John Smith | last post by:
I am using IE 6.0 from http://www.javaworld.com/javaworld/jw-07-1996/jw-07-javascript-p2.html I gather that "If you need to test a number of command lines, you can reduce the keystrokes by...
8
3621
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
4
2309
by: lmarceglia | last post by:
Hi, I have this website that doesn't work in Firefox 1.5: www.pianetaluca.com The HTML source is: <TITLE>PianetaLuca</TITLE> </HEAD>
7
9580
by: Coder | last post by:
Hi I have the following code in java script, it is not giving proper output in FIREFOX but running fine in IE... can anybody help me out to make this run in FIREFOX . <script...
11
3401
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
8
1909
by: Matt Kruse | last post by:
http://news.zdnet.com/2100-1009_22-6121608.html Hackers claim zero-day flaw in Firefox 09 / 30 / 06 | By Joris Evers SAN DIEGO--The open-source Firefox Web browser is critically flawed in...
16
2296
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
12
2556
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.