[SOLVED] Pop up pops up at the wrong time

This is a discussion on "[SOLVED] Pop up pops up at the wrong time" within the JavaScript Forum section. This forum, and the thread "[SOLVED] Pop up pops up at the wrong time are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 3rd, 2007, 16:44
Reputable Member
Join Date: May 2007
Location: Margate
Age: 24
Posts: 156
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Pop up pops up at the wrong time

Good evening,

When i click to another page it pops up. I am just after it popping up when the window is closed or when the user goes to another website.


HTML: Select all
<script>
function openpopup(){
//configure "seeyou.htm and the window dimensions as desired
window.open("seeyou.htm","","width=300,height=338")
}
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')==''){
openpopup()
document.cookie="popped=yes"
}
}
</script>

Cheers

Daniel

  #2 (permalink)  
Old Oct 4th, 2007, 07:56
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Pop up pops up at the wrong time

Hi Daniel,

How are you calling the function? Do you have the HTML that you are using..

I am thinking that instead of "trying to find" where the user is going, you might have to put a function to close the window when one your pages loads.

Cheers
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
  #3 (permalink)  
Old Oct 4th, 2007, 12:50
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Age: 27
Posts: 1,111
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Pop up pops up at the wrong time

Be aware that this is a bad use of a pop-up.

When a user closes your webpage or navigates away, he has decided that he doesn't want to stay. Don't annoy him with goodbye messages or try to prevent him from leaving.

You should not attempt to control the user's browser. It feels like assault.

These so-called "pop-unders" are frequently used by seedy warez and porn sites to generate more windows than the user can close. Modern browsers often block such pop-unders.
  #4 (permalink)  
Old Oct 5th, 2007, 04:49
Reputable Member
Join Date: May 2007
Location: Margate
Age: 24
Posts: 156
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Pop up pops up at the wrong time

Ok I have taken your advise on board MikeHopley, I do understand it is actually annoying now.

Cheers
Dan
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] What have I done wrong in this code? acrikey JavaScript Forum 6 Mar 23rd, 2008 22:39
Very wrong in IE7. Spot on in Mozilla & Opera. [SOLVED] Itsumishi Starting Out 15 Feb 17th, 2008 21:51
The time is wrong on my forum :( Stormraven JavaScript Forum 1 Jan 28th, 2008 17:39
Firework pops up corazon Web Page Design 2 May 27th, 2005 22:05
Adjusting time from server time to local time Tim356 Classic ASP 10 Jun 21st, 2004 14:57


All times are GMT. The time now is 22:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43