Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Internal Link In html Pop-Up


Dnj1964

Recommended Posts

Wanting to add links in the product description.

 

One option would to use target="_blank" but that opens a new page and leads the customer away from their original product interest.

Using

<a href="https://www.really-bad-idea.ca/index.php?cPath=92_212" target="popup" onclick="window.open('https://www.really-bad-idea.ca/index.php?cPath=92_212','popup','width=800,height=800'); return false;"> 'Water Based'</a>

Opens the link in a pop-up and works as a way to up-sell related products and keeps the customer on their original browsed to product.

Window is resizeable so works perfect on mobile as well.

 

Just wondering if there is a better way to do the same thing.

 

Thanks,

Doug

 

Link to comment
Share on other sites

Just a note that this code can be used for evil purposes. The URL in href= is the one shown by browsers (Firefox, anyway, I haven't tried it on others), but the address in window.open() is the one the visitor actually goes to. Not to give anyone ideas...

Link to comment
Share on other sites

2 hours ago, Dnj1964 said:

Just wondering if there is a better way to do the same thing

If all you need is to display info then simply use a modal. safe clean and bootstrap.

 

Link to comment
Share on other sites

If you dont wish to use a modal, you can still do this with simple html/js, The safe popup to use is this, thake a look at the image and when you move the mouse over it a popup opens giving you more info. Very simple code and can be simply added to any discription as a link. It can have text, images, links.......

Styling with simple css.

see example

https://www.w3schools.com/howto/howto_js_popup.asp

 <div class="popup" onclick="myFunction()">Click me!
  <span class="popuptext" id="myPopup">Put any content in here</span>
</div> 

https://chilleddisplays.co.uk/product_info.php/cPath/26/products_id/57

image.thumb.png.25caab2ac18ad6dc2b2c1a0098644313.png

 

Link to comment
Share on other sites

Per Doug's original code, I don't think the anchor tag (<a... /a>) does anything at all except provide a label to click on. You might be able to do the same thing with a <span onclick=...>label</span>. If you want the user to see the address the link is going to, you'll end up having to use <a href=..., but be careful to have the exact same URL in both, so your customers can't accuse you of hijinks.

Link to comment
Share on other sites

On 5/4/2019 at 10:44 AM, MrPhil said:

Per Doug's original code, I don't think the anchor tag (<a... /a>) does anything at all except provide a label to click on. You might be able to do the same thing with a <span onclick=...>label</span>. If you want the user to see the address the link is going to, you'll end up having to use <a href=..., but be careful to have the exact same URL in both, so your customers can't accuse you of hijinks.

Thank you.

That is exactly how I am using the code.

Didn't think of using <span onclick that may be a better option, don't care if url to customer or not.

Using it to supply a link and not direct away from original page.

Thanks again!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...