SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2006
    Location
    UK
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pop Up Help Please

    Two questions;
    1. How can I get a pop up to close automatically when the visitor leaves the page the pop up is on?
    2. Is there anyway you can stop pop ups being blocked? I have a pop up blocker but quite often still get them anyway so there must be a way. The pop ups I am using have relevant information to what I will be discussing with the visitor and I really need them to show or it will kind of defeat the object of my site.

  2. #2
    SitePoint Zealot
    Join Date
    Sep 2006
    Location
    Minnesota
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gooders2274
    1. How can I get a pop up to close automatically when the visitor leaves the page the pop up is on?.
    For some reason, I don't think this will be a problem... Otherwise, this should work:

    <html>
    <head><title>Close Window</title></head>
    <SCRIPT language="JavaScript1.2">
    function openpopup()
    {
    popwindow = window.open("", "mywindow", "status=1,width=100,height=100");
    popwindow.document.write('Surprise!');
    }

    function closepopup()
    {
    if(false == popwindow.closed)
    {
    popwindow.close ();
    }
    }
    </SCRIPT>
    <body onunload="javascript: closepopup();">
    <P><A href="javascript: openpopup()">Show Surprise</A></P>
    <P><A href="http://www.nextpage.com">Next Page</A></P>
    </body>
    </html>

    Quote Originally Posted by gooders2274
    2. Is there anyway you can stop pop ups being blocked? I have a pop up blocker but quite often still get them anyway so there must be a way. The pop ups I am using have relevant information to what I will be discussing with the visitor and I really need them to show or it will kind of defeat the object of my site.
    Simply just put a message in the page that says "Note: Pop-ups must be enabled". This is the ethical way.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •