PDA

View Full Version : DHTML window widget, How to keep popup opened with parent refresh



Socapex 2K
07-26-2009, 10:18 PM
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
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

Socapex 2K
07-26-2009, 11:21 PM
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 :o .

temporary
07-27-2009, 06:51 PM
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:


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

Socapex 2K
07-27-2009, 09:03 PM
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?

ddadmin
07-28-2009, 05:08 PM
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/search.php?searchid=4914347

Socapex 2K
07-28-2009, 08:57 PM
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