Solved

Alert telling people they are leaving the site

Posted on 2011-03-07
7
196 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now