MozillaZine

Gecko based browsers (Mozilla & Netscape) link issue

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
number6car
 
Posts: 4
Joined: December 23rd, 2014, 8:33 am

Post Posted December 23rd, 2014, 9:10 am

I have an asp page that works fine with Chrome, IE, and Safari but Firefox behaves differently. See http://tournamenttime.net/tournaments.asp. If you hover over the icons in the Flyer or URL fields you'll see the address that it's suppose to go to (and does so flawlessly in the browsers mentioned). In Firefox "http://tournamenttime.net" is added in the front of the address which breaks the link. Is this a Firefox (Gecko) specific issue or is it my configuration in the global.asa, calling script or somewhere else that causes this? Like I say, all other browsers connect to the links without issue. Thanks.

Dan

Gingerbread Man

User avatar
 
Posts: 7744
Joined: January 30th, 2007, 10:55 am

Post Posted December 23rd, 2014, 10:52 am

You're using backward slashes in the href attribute of the a element. You should be using forward slashes instead. As an example, here's what you have on the page currently, followed by what the HTML code should be:
Code: Select all
<a href="http:\\www.Tournamenttime.net\Flyers\2015basschamps.pdf"><img src="images/Flyer.gif" border="0" height="16" width="16"></a>

Code: Select all
<a href="http://www.Tournamenttime.net/Flyers/2015basschamps.pdf"><img src="images/Flyer.gif" border="0" height="16" width="16"></a>

When the files are on the same domain as the page you're liking from, you can use relative paths instead:
Code: Select all
<a href="Flyers/2015basschamps.pdf"><img src="images/Flyer.gif" border="0" height="16" width="16"></a>

Run your site through the markup validator to find other problems:
:arrow: W3C Validator results for tournaments.asp: 94 errors, 4 warnings.

number6car
 
Posts: 4
Joined: December 23rd, 2014, 8:33 am

Post Posted December 23rd, 2014, 11:27 am

I acknowledge that the slashes may be going the wrong way, but that doesn't explain why IE, Chrome and Safari resolve the addresses without issue and Firefox adds the local site name to the beginning of the link.

trolly
Moderator

User avatar
 
Posts: 39908
Joined: August 22nd, 2005, 7:25 am

Post Posted December 23rd, 2014, 11:46 am

It does. While Firefox interprets things strict to the standards the other browsers allow users doing stupid and illegal things.

Or short, a backslash is not a valid separator in an URI.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.

Frenzie

User avatar
 
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted December 23rd, 2014, 12:21 pm

trolly wrote:It does. While Firefox interprets things strict to the standards the other browsers allow users doing stupid and illegal things.

Ftr, the behavior might be different if the site weren't in quirks mode.
Intelligent alien life does exist, otherwise they would have contacted us.

number6car
 
Posts: 4
Joined: December 23rd, 2014, 8:33 am

Post Posted December 23rd, 2014, 12:57 pm

Frenzie,

Should I add a DOCTYPE for strict mode on the asp page to change the behavior (and change slashes)?

Frenzie

User avatar
 
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted December 24th, 2014, 5:41 am

Except on legacy pages, I doubt there is any reason not to use a DTD in 2014. Browsers behave significantly more alike when you do. The slashes should be changed regardless, although in this case it only makes a difference in the slightly outdated Opera/Presto. I'm negatively surprised that nothing changed about Blink's or IE10's behavior in strict mode, but apparently it's a willful violation of URL parsing in the spec: https://bugzilla.mozilla.org/show_bug.cgi?id=652186 (Presumably simply motivated by IE's buggy behavior and Webkit's copying it…)
Intelligent alien life does exist, otherwise they would have contacted us.

number6car
 
Posts: 4
Joined: December 23rd, 2014, 8:33 am

Post Posted December 24th, 2014, 10:33 am

Adding the strict DOCTYPE didn't resolve the issue. It still prepends the site name to the links. (see tournaments2.asp) The other browsers still resolve "correctly".

Frenzie

User avatar
 
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted December 25th, 2014, 3:30 am

Like I said, in this particular case it only seems to make a difference in Opera/Presto. In quirks mode it copies IE's behavior; in standards mode it behaves what I would call correctly. That is, it behaves the same as Firefox. However, more generally speaking quirks mode affects anything from document.documentElement to CSS handling of properties like padding and margin. In IE document.getElementById('bla') returns things like <a name="bla"> in quirks mode. And so on, and so forth.

PS The DTD you added (<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">) still results in quirks mode in every browser afaik. You probably want either
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

or simply
Code: Select all
<!DOCTYPE html>
Intelligent alien life does exist, otherwise they would have contacted us.

jscher2000

User avatar
 
Posts: 10761
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA

Post Posted December 31st, 2014, 6:29 pm

The DOCTYPE doesn't affect whether Firefox likes backslashes in URLs. It never likes them. Unfortunately, you'll need to globally replace them to forward slashes to fix your links for Firefox users.

Note: Alternately, you might also be able to create a 404 page that redirects to the correct sites when given the broken URLs, but I haven't tried to do it myself and it would depend on whether your host allows ASP in 404 pages.

LoudNoise
New Member

User avatar
 
Posts: 40048
Joined: October 18th, 2007, 1:45 pm
Location: Next door to the west

Post Posted December 31st, 2014, 7:03 pm

However, the proper DOCTYPE will make it more likely that all browser will show it more or less the same way (assuming proper coding) if I am not mistaken.

Also, almost every text editor will allow you to "\" to "/" with a simple click on Edit --> Search and Replace.
Post wrangler
"Choose between the Food Select Feature or other Functions. If no food or function is chosen, Toast is the default."

Frenzie

User avatar
 
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted January 1st, 2015, 3:38 am

That's what I've been saying. Using standards mode avoids a whole slew of potential issues along these lines and as such quirks mode is almost certainly a bad idea. That only Opera/Presto changes its behavior in this particular case is pretty much irrelevant to the general point.
Intelligent alien life does exist, otherwise they would have contacted us.

patrickjdempsey

User avatar
 
Posts: 23734
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC

Post Posted January 1st, 2015, 4:19 pm

I believe that when Firefox sees:

Code: Select all
<a href="http:\\www.Tournamenttime.net\Flyers\2015basschamps.pdf">


It cannot recognize it as a URL at all and is interpreting it as a relative path within the current domain. Imagine the backslashes are dashes:

Code: Select all
http:--www.Tournamenttime.net-Flyers-2015basschamps.pdf


So this is how Firefox is seeing that "address"... as just a really weird name for a pdf with no path information. Without any usable path information, it's correcting that weird file name it by adding the relative path:

Code: Select all
http://www.Tournamenttime.net/http:--www.Tournamenttime.net-Flyers-2015basschamps.pdf
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 2 guests