473,883 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ 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 1960
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?Sortin g"
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.c om...
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.c om/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.c om/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.c om/test-links-global.html."
--
http://www.standards.com/; See Howard Kaikow's web site.
"RobG" <rg***@iinet.ne t.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.c om/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.c om/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 "ThisandTha t", 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.replac e(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 "ThisandTha t", 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.replac e(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*********@dr n.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.demo n.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demo n.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demo n.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.de mon.co.uk> wrote in message
news:+r******** ******@merlyn.d emon.co.uk...
JRS: In article <co*********@dr n.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.demo n.co.uk/> - FAQqish topics, acronyms & links. PAS EXE TXT ZIP via <URL:http://www.merlyn.demo n.co.uk/programs/00index.htm> My DOS <URL:http://www.merlyn.demo n.co.uk/batfiles.htm> - also

batprogs.htm.
Jul 23 '05 #10

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

Similar topics

5
2224
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 in IE, though. I know, IE is a bit more permissive than IE, and sometimes lets errors work when they shouldn't. But from what I can see, I just don't see what's wrong.
13
8328
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 typing javascript: (remember the colon) in the Location box. Navigator displays a "JavaScript typein" frame at the bottom of the window. Type the command line you want to try, and press Enter. "
8
3685
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
4
2339
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
9635
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 language="JavaScript"> var cntlName; var eleTarget = document.getElementById('hiding'); function showOrHide(){
11
3445
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 no buttons react to clicking. The website's helpdesk says it should work with Firefox, and could not offer any more advices. The JavaScript Console shows that there are numerous errors occuring. It looks like the web browser does not recognise...
8
1934
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 the way it handles JavaScript, two hackers said Saturday afternoon. An attacker could commandeer a computer running the browser simply by crafting a Web page that contains some malicious JavaScript code, Mischa Spiegelmock and Andrew Wbeelsoi...
16
2341
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 on the same page work correctly. It appears to be isolated to 1-2 machines in a particular network. I cannot verify whether these machines have had virus/spyware scans, but I do know the user is running Firefox 2.1 and IE 7 with the same...
12
2623
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 than one line and the text simply overlaps the sub-menus below it. I thought i had got around this by placing empty 'spacers' like so; oFoldMenu.make('sub3','')//spacer unfortunately, i have just viewed the site in IExplorer and it has added...
0
11151
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10420
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9582
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7134
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5804
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5996
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4619
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.