PDA

View Full Version : DHTML Modal window session losing



ekshahar
02-23-2009, 04:46 PM
1) Script Title: DHTML Modal window v1.1

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

3) Describe problem: Now that I have learned how to load an external page to my iframe (with try catch block in close function), I have yet another problem. I am loading a page which uses sessions to store variables (for example a captcha string). However the sessions are destroyed or not saved in if gone through the modal window. It will work fine if I had to access it directly via browser. any information is highly appreciated.

ddadmin
02-23-2009, 08:29 PM
Is the page loaded inside the DHTML window from the same domain as the page launching it? If so, you should also ensure the "www" (or lack thereof) portion of the URL is the same for both pages as well.

ekshahar
02-23-2009, 09:23 PM
Is the page loaded inside the DHTML window from the same domain as the page launching it?: Nope the page loaded inside dhtml window is calling an external page.

--- aside from this problem I am having another issue. Yep, sure enough the window gets closed when i click the X button on external pages after adding the try catch block...however, lets say the external page is a form and then i submit the form which gives me the status of my submission (a different page, than originally loaded) in dhtml window. at that point i cant close it. for example.

my domain a.com makes a request to page1.php in b.com. page1.php gets loaded on dhtmlwindow on my page and i can click 'X' and get it closed with try catch. lets say page1 on b.com is a form which on action goes to processpage1.php, it will get loaded but i cant close the window at that point.

Hope it made sense.

ekshahar
02-23-2009, 09:33 PM
to add to the above note: I forgot to mention my original issue.

I am on a.com. calls page1.php in b.com on my dhtml window. page1.php in b.com actually uses session which gets passed to processpage1.php. However, it looks like sessions created within page1.php through modal window are over-written or getting destroyed when processpage1.php is rendered. if i go through normal route i mean if i loade page1.php in b.com from the url directly bypassing modal, sessions are working.

ddadmin
02-23-2009, 11:39 PM
Hmm there shouldn't be anything in the DHTML window that will overwrite sessions. To confirm this, what if on a.com, you simply created an IFRAME (using the IFRAME tag) that loads page1.php:


<iframe src="http://www.b.com/page1.php"></iframe>

Then, from page1.php, try and go to processpage1.php from within the iframe- do the sessions persist?

ekshahar
02-24-2009, 04:36 AM
yep tried that. no luck :(

ekshahar
02-24-2009, 04:44 AM
Thank god! fixed it. It only got fixed because I own both a.com and b.com. In b.com the form which calls processpage1.php through action i had to spell out the whole url. http://www.b.com/processpage1.php. and sure enough it preserves the session and window gets closed too. I guess this is not a modal window issue rather how sessions works. But i guess a nice experience. thanks admin for your time.