Results 1 to 6 of 6

Thread: DHTML window widget, How to keep popup opened with parent refresh

  1. #1
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML window widget, How to keep popup opened with parent refresh

    1) Script Title: DHTML Window Widget v1.1

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

    3) Describe problem:

    Hello, I am using the dhtml window widget script, and I have a problem. I'm using php for most of my site. When a user clicks on a form, I use the
    PHP Code:
    header('location:'.$_SERVER['PHP_SELF']); 
    because I get bugs on page reloads and need the information updated.

    Now, when the parent page reloads, my opened popups disappear (obviously). Has anybody been able to record the widget popups and their position/state (minimized) so that on a refresh, they can reappear where they were?

    Or maybe there's a way to keep them from even closing? Any ideas?
    Thanks a lot for help and all the great scripts here,
    Socapex 2K

  2. #2
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I've been thinking about this, and maybe have an idea or 2. ADVISORY: I know absolutely nothing about javascript... well, almost nothing

    Is there any equivalent to session variables in javascript? If so, then maybe I could set session variables for popup IDs and there location, and simply add a javascript part in my php if statement refreshing the parent, telling the browser to reload the info in the variables. Every time a user opens a pop-up, variables of size, location, target are saved. If the user moves or minimizes the popup, they are updated. OR, when the page reloads, javascript checks for all opened popups and their location, saves it, and then launched the DHTML windows again...

    Maybe the same could be acheived using cookies? As a plus, the user could have his popups reloaded when he logs-in again.

    I know javascript isn't server-side, so I'm not sure about the cookie thing. Anyway, just some thoughts. If you do have an answer, please be very detailed about the javascript since I'm a total beginner at it .

  3. #3
    Join Date
    Jul 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am pretty new to JavaScript as well... but maybe you could try using parameters to your page?

    You can use this code to access the parameters of a page in javascript:
    Code:
     var query = window.location.search.substring(1);
    var parms = query.split('&');
    for (var i=0; i<parms.length; i++) {
        var pos = parms[i].indexOf('=');
        if (pos > 0) {
            var key = parms[i].substring(0,pos);
            var val = parms[i].substring(pos+1);
            if(key == "something you wanted to carry to the next page") {
                 var IneedThis = val;
            }
        .......
    And then when you call your page in PHP figure out how to send the parameters that you need?

    Good luck

  4. #4
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I will research this. I guess I'll end up having to learn javascript anyway, because I need a bit of ajax and because it seems just so powerfull. Anybody else got an idea?

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

    Default

    There are a couple of threads about using cookies to remember/ persist a DHTML window being opened when the page reloads. Please see: http://www.dynamicdrive.com/forums/s...archid=4914347
    DD Admin

  6. #6
    Join Date
    Jul 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply, but the link doesn't work... It'd be nice to post it again, or maybe redirect to another post. I have searched a lot for this and haven't found any answers :/
    Thanks

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
  •