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

Thread: DHTML Window widget: Pop up once per browser session only?

  1. #1
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Window widget: Pop up once per browser session only?

    Script: http://www.dynamicdrive.com/dynamici...ndow/index.htm (added by ddadmin this time).

    I am trying to make a website for the staff at a school, and it can only be accessed locally - it's not posted on the web. I used the "DHTML Window widget" from this site to make a pup-up when you open the home page, so it shows pictures when ever the staff open the site. The problem is - it can get annoying when it opens this image every time you go back to the home page. For a demonstration, go to Windows and Frames on Dynamic Driva, and click on DHTML Modal window. Try clicking back and forward - it just takes time, when the staff could just disable it not to show until the next day, or until the browser is closed and then reload the next time the browser opens. Does anyone know how this can be made? I'm new to DHTML and JavaScript, so I can't come up with something myself. If anyone can help me, that would be appreciated. I need this ASAP.
    Last edited by ddadmin; 05-10-2007 at 09:49 PM.

  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 when asking a question.

    Try the below modified dhtmlwindow.js file instead, which adds support for session only persistence, so you can set a window to only pop up once per browser session. This is realized by a new optional parameter at the very end of dhtmlwindow.open(). Whereas before you had something like:

    Code:
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=0,scrolling=1,center=1", "recal")
    To get this window to only pop up once per browser session, throw in a new parameter at the very end:

    Code:
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px,resize=0,scrolling=1,center=1", "recal", "sessiononly")
    I'll be adding cookie support to this script formally the next time it's updated.

  3. #3
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, but unfortunately this site is not on a server, so we can't use cookies. I'll probably end up just creating a link that opens this pop-up, unless somebody suggests a better option. Thanks again for your time.

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

    Default

    Well, these are client side cookies, meaning they are stored in the visitor's browser...

  5. #5
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    Hello,

    I'm also trying to use "DHTML Window widget (v1.03)".
    I would like to have this opened every X pages.
    How can i set this, instead of having it opened everytime a page is opened?

    Thanks

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Show it if there is no cookie (first time), then create a cookie with the number "5" as its value. On each page, check for that cookie and:
    1. If no cookie, see above.
    2. If value over 1, set the cookie to its value-1, so the first time 4, then 3, etc.
    3. If the value is 1, then clear the cookie.

    Or, if preferable, you could (3) set the cookie to 0, then, if value is 0, do (1).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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

    Default

    Greetings,

    I am trying to do something similar with this script and since I'm pretty much a noob at this stuff I wonder if somebody could help me.

    I would like to load this dhtml window once when a users logs in to an intranet page. I know on the page whether or not I want to display the popup window but I don't know how to trigger it.

    In other words, say i wanted the window to launch if the day is Tuesday. On the page I know if it's Tuesday but don't know how to "trigger" the window. Any other day of the week the window would not open.

    Thanks-

  8. #8
    Join Date
    Jun 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am just doing a quick post and maybe this will help. I never send users off to another website directly. It's a best-practice to have a redirect page in PHP, ASP or whatever, that is the popup window target with the URL as a parameter. Then in the redirect.XXX you 301 redirect to where ever you want to send them. If you want you can add some SQL and save any server or QS values you want.

    --Steve

  9. #9
    Join Date
    Jan 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Has this mod been rolled into the latest version of the script? Looking at it, it appears not.

    Thanks,

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

    Default

    Sure, attached is dhtmlwindow.js (v1.1), modified like above to include the optional "sessiononly" only variable when opening a DHTML window, so it only opens once per browser session.
    Last edited by ddadmin; 01-20-2008 at 06:55 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
  •