• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session lost with window.open()

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've read the similar topic below, but my problem is slightly different in that there is no intervening servlet.
When I use window.open() to open a new window, the session object i had previously is lost.
How can I retain the session in the new window?
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you opening your new window from? Is it a JSP? Or an HTML page? If it is a JSP then just use the encodeURL method to generate the new window URL.
If it is an HTML page then how is it generated? If it just a static file then I dont think you can get the session info to it, you'll have to change the page to be generated by a JSP or servlet. If it is already generated by a servlet you can jst use the encodeURL method to create the URL and place it in the generated page.
does that help? If not post some code or another explaination.
 
Padraig Joseph
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, encodeURL worked...
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same problem with window.open() but what's even worse: i don't give any url because i load the new window's contents with document.write() methods. (Obviously, i have no chance to use encodeURL in this case ) What is the solution?
(some msdn pages said that this is an IE bug and should be worked around by turning off the "launch ie windows in a separate process" checkbox... i wonder if it's true, but is this REALLY the only way?... ask my users kindly to switch it off and think of Gates instead of me? )
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why cant you use encode URL? Althouhg you are generating the content of the page dynamically using javascript, it must be possible to write part of the javascript dynamically, like
var think = "<%=encodeURL("/")%>";
or something, that should allow you to capture the session key (there might even be a less gruesome way of doing it) so that you can use it to encode an URLs that you create dynamically with your javascript
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys... does this problem occur when I used javascript?? for example:
<A href="javascript opUp('<%=url%>')">
I have couple of pages with this javascript but I'm not sure if I run into the same problem..
I don't know what encodeURL is and what it is for...
thanks
 
Denes Kellner
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by chanoch wiggers:
why cant you use encode URL? (...) like
var think = "<%=encodeURL("/")%>";
or something


Well, either you don't understand the problem or i don't see the solution... I don't believe that Explorer would act different just because of using a string-to-string function in my code.
However, i walked around the problem in the past few hours and i found that if i open a simple window when my program starts (and ask user not to close it, for a whatever reason), this solves the Whole Big Explorer 6 Problem (aka WBE6P from now on ) So this is a quick patch until ms comes out with the bugfix. Basically, the cookie problem happens when you close the LAST window that has been window.open()-ed by your site. If one of them stays, your session parameters stay too.
There are a few cases when Explorer doesn't lose the cookie but these are more like accidents. Normally it does. This is a documented bug, see http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q315713 for details. BUT DON'T THINK IT'S OKAY if you download the browseui.dll mentioned on this page - i got that 1024512 bytes long version and it does NOT solve the problem. What you really can do is 2 easy-to-follow steps: sit and wait

(any other patch or solution or workaround or whatever would be still appreciated! thx)
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just had the same behaviour (IE 5.5), this solution was implemented in Websphere 4.0.3 but should work with the others too...
Turn on URL Rewriting, use response.encodeURL("") to add the session ID to the URL.
Does this help, or am I just confusing things at this stage?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have had the same problems with our popups losing the cookie from the parent window, and I have been given the task to find a solution. I'm looking for a solution, (eg. download this patch, upgrade to new service pack) not a work around. Has anyone successfully fixed this, short of reinstalling your OS? I have tried to update my browser service packs, but I still get the same behavior in the popups. I have the newest version of IE6 and it still happens. We also have an exe that we use to call a browser in our own window, and the session lost on the popup ALWAYS happens on all of our machines which leads us to believe it is a Microsoft OS problem rather than an IE problem. Any help with this would be appreciated.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this is an old thread -- but I just found it while researching a problem I'm having. I'm trying to figure out if this thread is talking about the same issue.
I have an asp application. It consists of a main form page with links that open up popup windows (using javascript window.open). At the beginning of each page I have vbscript that checks to make sure session("logonID") is still there in case anyone timesout the app, or tries to enter a page without going thru logon. Fairly regularly, but not every time, when I click on a link to open a popup, the popup window doesn't not recognize my logonID. As if it is no longer part of the session. When this happens to me the only thing to do is to completely shut down my computer and bring it back up. Then it works fine. This happens on dev, test, and production. When this has happened to me, I've checked it out on a co-workers computer and it does not happen with him. The application has been in production over a year, and only two users have ever complained of the same issue (Yesterday it happened to the second user.Itwas the first time this has occured for him - I believe he is on a new laptop. He uses IE5.5. I use IE6 and my coworker uses IE6. I searched the web and found that IE5 had a bug like this that was fixed. Does this bug still exist in later versions? Is must be initatied by something because it doesn't happen all the time.
Has anybody come up with a solution to this?
 
reply
    Bookmark Topic Watch Topic
  • New Topic