
Originally Posted by
lat9
Assuming that you want to link to
http://zen-cart.com, you'd add the following:
Code:
<a href="//zen-cart.com" target="_blank">Zen Cart!</a>
Omitting the http: from the link makes it so that you won't get "mixed content" (i.e. http:// content on an https:// page) and the target="_blank" opens the page in a new window.
Mind if I add my 2cents worth? Too bad <g>
If it is known that external link supports SSL, then it is better to explicitly define it in the href rather than using the protocol-agnostic link as you've described.
EG:
Code:
<a href="https://zen-cart.com" target="_blank">Zen Cart!</a>
rather than
Code:
<a href="//zen-cart.com" target="_blank">Zen Cart!</a>
However, if the link is included in a page that will never be used with SSL, then it is better to use
Code:
<a href="http://zen-cart.com" target="_blank">Zen Cart!</a>
The protocol agnostic links should be a 'last resort' rather than a 'front line' method.
For the coders amongst us, the protocol agnostic links are much like a 'loosely/weakly typed' language vs a 'Strongly typed' language.
It works most of the time, but it can also have unexpected and unwanted behaviour.
Where possible it pays to be explicit.
Cheers
RodG