Forum Moderators: open

Message Too Old, No Replies

Problem with dynamic link

Work in all browsers but Mozilla

         

DrOliver

10:36 am on Apr 2, 2003 (gmt 0)

10+ Year Member



I have a link like that:

<a href="file.asp?View=2&amp;ID=678">News ID 678</a>

Now, this works in all browsers but Mozilla (don't know about Netscape 6/7, but I guess this won't work in these either).

The page does validate, and the link even works in Netscape 4... So what does the Gecko-engine not like about it? Any ideas?

takagi

10:41 am on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> <a href="file.asp?View=2&amp;ID=678">News ID 678</a>

Is this "&amp;" really part of the URL or did you add it when creating this thread?

DrOliver

10:55 am on Apr 2, 2003 (gmt 0)

10+ Year Member



This &amp; is really in the code. The link doesn't work in Mozilla with "&" or with "&amp;"

g1smd

10:38 pm on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The &amp; code is required instead of just & as all ampersands in HTML documents must be escaped.

msr986

10:47 pm on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DrOliver,

What kind of failure are you getting?

Did you try a fully qualified URL such as:

<a href="http://www.domain.com/file.asp?View=2&amp;ID=678">News ID 678</a>

DrOliver

6:28 am on Apr 3, 2003 (gmt 0)

10+ Year Member



Okay, so far so good. Takagi has helped me via sticky mail. We found that the problem occurs only in Mozilla in my office :) (Both home and office version are Moz 1.2.1)

It used to not work at home too, but surprisingly now it does. It seems that I have different settings in Mozilla at home and at the office which trigger the problem or then it might even be a proxy-related problem, because in my office I am behind a proxy.

It still seems kind of weird to me, because the problem only occurs in Mozilla, not in any other browser.

DrOliver

6:54 am on Apr 3, 2003 (gmt 0)

10+ Year Member



Hey, we got it. Takagi told me to switch the dynamic links from "ID" to "?", to help Google and other SEs index the pages. (See this thread [webmasterworld.com])

Funny enough, that solved the problem in Mozilla. Well, takagi thought it is "unrelated", but it seems that it somehow was related.

Thanks to all who tried to help and two thumbs up for takagi! :)

takagi

9:03 am on Apr 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm happy for DrOliver that his problem is solved, but I'm not sure if the current solution is a good one. I did encourage him to rename the "ID" in the URL. However, having 2 question marks in the URL is kind of weird.

A URL should be build like this
<protocol>//<host>[:<port>]/<pathname>[<hash>][<search>]

For example [mydomain.com...]

<protocol> = "http:"
<host> = "www.mydomain.com"
<pathname> = "widgets/faq.asp"
<search> = "?item=3&t=2"

Having an extra question mark in the search like

<search> = "?view=2&?=128"

is rather unusual. I strongly advice DrOliver to look for another sequence to avoid future problems.

g1smd

10:25 pm on Apr 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Whatever happens, whenever the link is published on a web page, the ampersand must be escaped by changing it from & to be &amp; instead.

The browser will send the correct unescaped version to the server, and the display will be rendered correctly (unless there is a bug in the browser).

Typing a link into the browser address bar with &amp; in it usually does not work (just in case anyone is tempted to try it).

andreasfriedrich

10:43 pm on Apr 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



takagi [webmasterworld.com] wrote at 09:03 AM on Apr. 03, 2003 in message #8 [webmasterworld.com]
>>Having an extra question mark in the search like [...] is
>>rather unusual. I strongly advice DrOliver to look for
>>another sequence to avoid future problems.

Having question marks in the query component of a URI is not a problem at all. RFC2396 - Uniform Resource Identifiers (URI): Generic Syntax [faqs.org] defines query as *(reserved ¦ unreserved ¦ escaped) where reserved characters are: ";" ¦ "/" ¦ "?" ¦ ":" ¦ "@" ¦ "&" ¦ "=" ¦ "+" ¦ "$" ¦ ",". The first question mark will delimit the query component. In the query string all uri characters (reserved ¦ unreserved ¦ escaped) are allowed.

Andreas

DrOliver

1:56 pm on Apr 7, 2003 (gmt 0)

10+ Year Member



Well thanks again to all of you. Interesting enough, the problem was not related to what has been mentioned in this thread. It's much more simpler: it's related to cookies. The links only work when cookies are allowed. Go figure!

Well, I took the site in question over from somebody else, so until I saw a little more behind it I just could not see that it was that simple. So I am going to change the error message to something more understandable, and that's it.

But I've lerned a thing or two now. I hope somebody else has taken same advantage from this thread. Cheers :)