Forums / Templates, Stylesheets, Page Layout / External Link in Product Description

External Link in Product Description

Views: 746

Results 1 to 5 of 5
10 Mar 2015, 3:20 AM
#1
rufusclc avatar

rufusclc

Zen Follower

Join Date:
Sep 2008
Location:
San Diego
Posts:
159
Plugin Contributions:
0

External Link in Product Description

Hi:
I would like to add an external link to the text on a product description page to link to an album on another site.
How would I add the link?
Thanx in advance
Rufus in Del Mar CA

10 Mar 2015, 12:24 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,109
Plugin Contributions:
56

Re: External Link in Product Description

Assuming that you want to link to http://zen-cart.com, you'd add the following:

<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.

10 Mar 2015, 1:03 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: External Link in Product Description

lat9:

Assuming that you want to link to http://zen-cart.com, you'd add the following:

<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.

Important thing to note as lat9 eluded, is if the destination supports the https: and http: call as applicable for the page displaying the link.

Couldn't the product url field on the product information page also be used? (Assuming 1) that is an acceptable solution by the OP, 2) the template properly supports it, and 3) display of that field is on for the product type.)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

10 Mar 2015, 6:18 PM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: External Link in Product Description

lat9:

Assuming that you want to link to http://zen-cart.com, you'd add the following:

<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: 

<a href="https://zen-cart.com" target="_blank">Zen Cart!</a>

<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 

<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

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

11 Mar 2015, 11:51 AM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,109
Plugin Contributions:
56

Re: External Link in Product Description

RodG, good advice (as always). Thanks for the clarification.