Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm using a pop-up as an entry to o

Status
Not open for further replies.

StephanieCC

Technical User
Aug 28, 2001
48
US
I'm using a pop-up as an entry to our in house website--so that if the user agrees to our rules clicking yes closes the opo-up and lets the user use the web; clicking no, should close the pop-up and the browser--I have the pop-up as a dependent and set the no button to parent.close and then window.close but it still only closes the pop-up-- any ideas?

 
I have an idea.
First of all, people can use the web by simply ignoring the popup. Why don't you do a confirm box instead?

<html>
<head>
<script>
<!--
function check(){
if(!confirm(&quot;do you agree?&quot;)){
//this could become annoying as it will always ask
//the user if he wants to close the browser.
//replace it with:
// return false;
// will might be better
self.close();
} else{
location.href=&quot;new_page.html&quot;;
}
}
//-->
</script>
</head>
<body onLoad=&quot;check();&quot; onUnLoad=&quot;check();&quot;>
</body>
</html>

Rick It's a pleasure to know that I've helped you. If I have,
please click the link below to let me know. :)
 
StephanieCC,

ristmo2001's idea is good - also, you cannot close a window that was not opened via script without the user's permission. so, if you call &quot;opener.close();&quot; from your pop-up, the user will still be prompted with something like

&quot;The web page you are viewing is attempting to close the browser. Do you want to allow this?&quot;
======================================

if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top