?
Solved

Alert telling people they are leaving the site

Posted on 2011-03-07
7
Medium Priority
?
203 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
Suggested Courses

771 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