Avatar of swgdesign
swgdesign
Flag for United Kingdom of Great Britain and Northern Ireland asked on

JQuery modal popup for external web links

I need to add in some jquery functionality for links to external websites, so that we may warn users that we are not inc ontrol of external content etc. The jquery box I guess should be modal and have OK and CANCEL buttons. When OK is clicked the external link is loaded.

Would be grateful of a working solution with code/demo as I haven' got that much time to implement it.
JavaScriptAJAX

Avatar of undefined
Last Comment
swgdesign

8/22/2022 - Mon
Roman Gherman

Why not use simple javascript?


<a href="www.someExternalLink.com" onclick='return confirm("We are not in control of external content. Do you still want to navigate?")' > test</a>
dr_Pitter

Here's an jQuery example:

1) mark all links to extarnal pages with a special classname, i.e. 'extern'

2) include this script to your html-document:

$(function(){
 $('a.extern').click(function(){ return confirm('We are not ...'); });
})

Open in new window

swgdesign

ASKER
Maybe I should have been more specific; I am looking for some sort of modal popup window like simpleModalDialog but with the ability to go to the link when confirm or yes is clicked.

I can code a standard js confirm using jquery, but I need something classier!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Roman Gherman

then use jquery confirmation dialog:

http://jqueryui.com/demos/dialog/#modal-confirmation

Click viewsource and see how it is implemented
Roman Gherman

swgdesign

ASKER
I'm looking for something more lighbox'ie.

Thanks anyway for your recommendations.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
swgdesign

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
swgdesign

ASKER
No one suggested anythign close to the solution I required so I coded it form scratch using jQuery.