Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: easy way? popup only if first time

  1. #1
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default easy way? popup only if first time

    hi, if you goto http://pjrey.com
    you will see a popup telling you about how i iwll be gone bla bla...

    is there a way to have it only popup for first timers.. if you have been to my site before, it wont pop up again...
    how can i do this..
    im sure its very easy to do with cookies..

    any help would be great

    to summerise...
    i want that info popup to only pop up to people who have never been to my site before, once they close it.. it will never be shown to them again...

    thanks
    pj

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question. Also, the credit notice inside this script has been removed (not visible when view source). This is against our usage terms: http://www.dynamicdrive.com/notice.htm

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

    Default

    ddadmin.. the credits are there! i never removed them!
    they are in the JS file. i added them to the HTML to make everyone happy!

    so, how can i do this with cookies?
    i want it only shown if it has never been showen before...
    if it has, i want nothing in its place...


    thanks
    pj

    EDIT: aslo, is it possible to have the cookie be deleted, or reset when i modify the dropbox? if i change something, to have it reappear to the viewers...

    so, view once, after that not show up again (unless the box has been modified)

    thanks!!
    Last edited by pjrey; 10-28-2005 at 12:02 AM.

  4. #4
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    no one knows how to do this??
    hmmm

    alright..
    p

  5. #5
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    anybody????

  6. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hi:
    Sorry for the delay. FYI the credit notice needs to be visible in the HTML page if the script is moved to an external .js file, so for example:

    <script src="js/away_message.js">

    /******************************************
    * Popup Box- By Jim Silver @ jimsilver47@yahoo.com
    * Visit http://www.dynamicdrive.com/ for full source code
    * This notice must stay intact for use
    ******************************************/

    </script>

    To your question, to make the script pop up only once per browser session for each user, first, edit the DIV tag that contains your popup content with the below in red:

    <div id="showimage" style="position:absolute;width:auto;left:300px;top:300px; z-index: 1;display: none" class="threefifths">

    Then, add the below script to your page:

    Code:
    <script type="text/javascript">
    var isloaded=0
    window.onload=function(){
    if (document.cookie.indexOf("isloaded")==-1){
    document.getElementById("showimage").style.display="block"
    document.cookie="isloaded=1"
    }
    }
    </script>

  7. #7
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks..
    but when you say once per session, does mean when the browser is closed, and reopened it will show again?
    i dont want this.. only if the cookies were cleared would it allow itself to be shown again.
    i wish for it to be shown once, set a cookie, and then never show again, unless i change the cookie name, or the user deletes the cookie...

    i dont want it showing up again for them, even if they have closed IE/FF/NN and reopened it...

    thanks for getting back to me!~!
    pj

  8. #8
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    does anybody know how to do this??
    please help, i will be going out of town very soon... would like to figure this out before i go.. thanks. pj

  9. #9
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Sorry for the delay. To make the cookie feature persistent, change the script I posted above to:

    Code:
    <script type="text/javascript">
    var isloaded=0
    window.onload=function(){
    if (document.cookie.indexOf("isloaded")==-1){
    document.getElementById("showimage").style.display="block"
    var expireDate = new Date()
    expireDate.setDate(expireDate.getDate()+100)
    document.cookie = "isloaded=1; path=/;expires=" + expireDate.toGMTString()
    document.cookie="isloaded=1"
    }
    }
    </script>
    This will cause the pop up to only do so once 100 days, which should be long enough in most cases.

  10. #10
    Join Date
    Oct 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks again for your help.
    but is it possible to just have it change when i update it? (i could rename the cookie...?)
    i am not familiar with cookies one bit, as you can surely tell!

    thanks ddadmin

    pj

    EDIT:
    i just tried it out.. no goo... when i close my browser and try again it pops right back up... with EI and FF...
    i want this to be gone for good... unless i rename/edit the contents

    thanks
    Last edited by pjrey; 11-04-2005 at 09:49 PM.

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
  •