Jump to content
Sign in to follow this  
Dnj1964

Internal Link In html Pop-Up

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

 

Share this post


Link to post
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...

Share this post


Link to post
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.


 

Share this post


Link to post
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


 

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×