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
Solved

Alert telling people they are leaving the site

Posted on 2011-03-07
7
199 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

839 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