Solved

Alert telling people they are leaving the site

Posted on 2011-03-07
7
202 Views
Last Modified: 2012-05-11
I have a website with four links to outside websites. The client wants a box to appear when they click one of these links that says - You are now visiting a site outside of the ourwebsite. To return to our website, close this browser.

Any quick things I can add for this?
0
Comment
Question by:katlees
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 35058730
0
 
LVL 7

Expert Comment

by:dxdinh
ID: 35058892
<script language="javascript">

function Redirect (url)
{
   if (confirm('Are you sure - you want to leave our site?'))
{
   document.location.href= url ;
}
}


<a href="#" onclick="Redirect('http://www.outlink.com');"> outside link 1</a>
0
 

Author Comment

by:katlees
ID: 35059065
dxdinh - this did not work. It doesn't go anywhere and no pop up shows up.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:dxdinh
ID: 35059142
I forgot the close script tag
Can u try
onclick="javascript:Redirect(...
0
 

Author Comment

by:katlees
ID: 35059472
This is what I Have so far.. It doesn't do anything when I click on it.

<script language="javascript">
function Redirect (url)
{
   if (confirm('You are now visiting a site outside of the Bank's website. To return to Bank's website, close this browser.'))
{
   document.location.href= url ;
}
}
</script>
<p><a onclick="javascript:Redirect ('https://usa.visa.com/personal/security/vbv/index.html?ep=v_sym_verified');" href="#">Verified By Visa Account Notification</a>
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 35059525
Escape the simple quotes in your message using : \


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	function Redirect (url) {
		if( confirm('You are now visiting a site outside of the Bank\'s website. To return to Bank\'s website, close this browser.') ) {
	   		document.location.href = url;
			return false;
		}
		return false;
	}
</script>
</head>
<body>
<p><a onclick="return Redirect('https://usa.visa.com/personal/security/vbv/index.html?ep=v_sym_verified');" href="#">Verified By Visa Account Notification</a>
</body>
</html>

Open in new window

0
 

Author Closing Comment

by:katlees
ID: 35059779
Perfect - thanks.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question