• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

close browser, open new window

 
Marcel de Jong
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
is it possible to open a new window when the user closes the browser or when they type in a new URL in the address bar?
Regards,
Marcel
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on exit pop ups are a pain to code since there is no way to catch it in an easy manner.
onunload will work on links and everything else like back button, etc. The easiest way is frames, have the onload on an visibnle frame and when that is closded it will open it up, but then you loose the functionability of the site.
Onunload pop ups will drive people away from your site
 
Marcel de Jong
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
first of all "Happy New Year" to every one. ;-)
I've tried using unload, and it is working. However, it does it every time I unload the page. It also fires when I leave the page via a link. Thats what I don't want. I only want to popup to show when the user exits the page via:
- a new URL in the addresbar
- exiting the browser
Any ideas?
Marcel
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way you can do it is with frames.......
 
Marcel de Jong
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it is possible?
can you tell me how to do it?

Thanks,
Marcel
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
frame of zero height
the frame never changes.,.
have this code in the source
<script>
function OpenIt(){
PeopleWillHateYou=window.open('TheyWillNotComeBack.htm');
}
window.onunload=OpenIt;
</script>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic