Results 1 to 5 of 5

Thread: How do I only run script on 1st visit?

  1. #1
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How do I only run script on 1st visit?

    I just put a little javascript on my website to launch a small mailinglist subscription box when users visit the page. How would I go about setting it so it only loads on the first visit or so it stops loading once they sign up? I'm willing to figure out the code on my own, but I need someone to point me in the right direction.

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,440
    Thanks
    78
    Thanked 3,443 Times in 3,404 Posts
    Blog Entries
    12

    Default

    This is not something that javascript is well suited to. A javascript cookie is the closest thing available but isn't robust enough for this purpose. What kind of mailing list is this? If it is a server based list with a server based program, a way should be able to be devised to do this server side in a much more robust manner than javascript can accomplish.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The mailing list is a cgi script, but that's unrelated to the pop up window, it just has some content (form with a text entry box) in the window.

    When visitors go to the main page of my site, the smaller window pops up. I'm just trying to not be too annoying by having it pop up every time they go back to the home page. Even if I could make it do it just once a session that would be good. Can javascript handle that? If not I guess I'll just have to accept being annoying.

    If you want to see for yourself what I'm talking about - www.ahdchild.com

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,440
    Thanks
    78
    Thanked 3,443 Times in 3,404 Posts
    Blog Entries
    12

    Default

    I get the picture. A javascript cookie would make a good session only check for something like that. Cookies are a little tricky but there have been several 'units' (a grouping of functions that do the hard part for you) written that make them a breeze. One such 'unit' can be found on this page along with an explanation of the use of the unit and principals involved. The unit itself is at the middle of the page. Let me know if you need help implementing it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That is exactly what I was looking for. Thanks so much

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
  •