|
Many years back the specifications for an ampersand (&) in dynamic URL's got misinterpreted. They thought it applied everywhere an ampersand appeared instead of only encoding it where it would cause problems sending a URL to a web server.
The ampersand (&) has a specific task in URL's as a separator between passed parameters. If its use as a separator is encoded, it will not function correctly in the Address line. If you are trying to pass "Boys&Girls" to a script, the following will fail and the destination will only receive "&SUBJ=Boys". "&Girls" will be an empty parameter and unexpected.
http://BIZyCart.ASP?GROUP=Shirts&SUBJ=Boys&Girls&CLIENT=SEO
Properly formatted, the Address line should look like:
http://BIZyCart.ASP?GROUP=Shirts&SUBJ=Boys amp;Girls&CLIENT=SEO
or
http://BIZyCart.ASP?GROUP=Shirts&SUBJ=Boys 26Girls&CLIENT=SEO
If it appears in the browser's Address line formatted as:
http://BIZyCart.ASP?GROUP=Shirts amp;SUBJ=Boys amp;Girls amp;CLIENT=SEO
The destination script will receive "GROUP=Shirts&SUBJ=Boys&Girls&CLIENT=SEO" as the information for the GROUP parameter and the others will be empty. Keep in mind at this point we are referring only to what appears in the browser's Address line and sent to the destination.
If you type the following into a web page, what will appear in the browser's Address line when the link is clicked is the first example. The destination script will only receive "SUBJ=Boys" instead of "SUBJ=Boys&Girls".
A HREF="BIZyCart.ASP?GROUP=Shirts amp;SUBJ=Boys amp;Girls amp;CLIENT=SEO"
VALIDATE /A
The way the browsers automatically convert any " amp;" into " " makes it awkward to pass something like "Boys&Girls" to a destination script. To get a value with an ampersand properly into the Address line, it requires doing it in scripting so no browser conversion will occur or use 26 instead of amp;. This includes passing a dynamic URL to another script.
A HREF="BIZyCart.ASP?GROUP=Shirts SUBJ=Boys 26Girls CLIENT=SEO"
VALIDATE /A
or
A HREF="BIZyCart.ASP?GROUP=Shirts amp;SUBJ=Boys 26Girls amp;CLIENT=SEO"
VALIDATE /A
should work properly.
Using "BoysAndGirls" or "Boys and Girls" is another way to step around this problem example. You'll also notice the browser automatically encodes the spaces as 20 for the Address line. It may not be needed depending on the script or program decoding and using the URL.
It's rather obvious that links inside a web page should follow the same format seen in the Address line. Now that you understand better how dynamic URL's must appear in the Address line and that the browsers fix things automatically, you can relax and stop typing the extra "amp;" in your links. You can also ignore the warnings about &'s in your readable text. That usage has nothing to do with using them as separators in URL's and all of the browsers know that. The ONLY time an " amp;" is required is when it is inside a value passed for a parameter in a dynamic URL. |