in javascript you could also check the window.opener object - if it is not null then it was opened by an existing window. Beware though of the fact that for frames in framesets this is sometimes set to the frameset page, this can be filtered out by checking window.parent or checking to see if window == top etc.
> -----Original Message----- > From: Dror Matalon [SMTP:[EMAIL PROTECTED]] > Sent: 13 August 2002 07:51 > To: [EMAIL PROTECTED] > Subject: Re: Multiple windows in a browser going to the same servlet > > I finally figured out the answer to this. The following web page > demonstrates how you can tell in javascript if a page is new or > old. > > > <html> > <body> > > <h1> > <script language="JavaScript" type="text/javascript"> > if (window.name == "foobar") { > document.writeln("old window"); > } > else { > window.name = "foobar"; > document.writeln("new window"); > } > </script> > </font></b> > <noscript> > </noscript> > <h1> > </body> > </html> > > On Mon, Aug 12, 2002 at 05:59:59PM -0700, Dror Matalon wrote: > > > > Assume that you have page foo.html in windows 1 that has a link to > > bar.html in it. The question is, how do you tell the difference betwenn > > the user clicking on the link and going to bar.html and the user right > > clicking on the link and choosing "open link in new window" (there's > > different ways of doing this in different browsers). In the first case > > you have bar.html in window 1, in the second you have bar.html in window > > 2. How would the javascript know to do different things in the different > > windows? > > > > > > On Mon, Aug 12, 2002 at 05:24:36PM -0400, Jayson Falkner wrote: > > > Use JavaScript to encode your URLs with the window name, or some other > > > unique ID. > > > > > > For instance: > > > > > > http://www.foo.com?pageid=page1 > > > > > > Then mine the information out on the server-side accordingly. Given > your > > > specific use, it may be possible to encode the links on the > server-side > > > to achieve the same goal. > > > > > > Another much more simple solution would be to ask a user to configure > > > the web browser so that it does not share session cookies between > > > different windows. Most every browser allows this. Assuming you used > it, > > > the different windows should reliably have separate sessions. > > > > > > Cheers, > > > > > > Jayson Falkner > > > [EMAIL PROTECTED] > > > > > > Dror Matalon wrote: > > > >Hi folks, > > > > > > > > > > > >As part of the zapatec platform we need to be able to tell if two > > > >requests come from the same window, or they come from different > windows. > > > >For instance a developer might be building the application in one > window > > > >and testing it in a second one, and we want to be able to tell which > > > >windows is which. > > > > > > > >AFAIK A servlet has no good way to tell if two requests are done from > > > >the same browser window or from two different windows, as long as > both > > > >windows are part of the same session. Looks to me like you need some > > > >client side help, probably javascript, to do that. Looks to me like > the > > > >window name would be a good way to tell windows apart, but I'd be > > > >interested in hearing how others folks handle this issue. > > > > > > > >I'd appreciate any hints or URLs. > > > > > > > >Thanks, > > > > > > > >Dror > > > > > > > > > > > >-- > > > >Dror Matalon > > > >Zapatec Inc > > > >1700 MLK Way > > > >Berkeley, CA 94709 > > > >http://www.zapatec.com > > > > > > > > >_________________________________________________________________________ > __ > > > >To unsubscribe, send email to [EMAIL PROTECTED] and include in > the body > > > >of the message "signoff SERVLET-INTEREST". > > > > > > > >Archives: http://archives.java.sun.com/archives/servlet-interest.html > > > >Resources: > http://java.sun.com/products/servlet/external-resources.html > > > >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > > > > > > > > > > > > > > > > > > > __________________________________________________________________________ > _ > > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > > > of the message "signoff SERVLET-INTEREST". > > > > > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > > > Resources: > http://java.sun.com/products/servlet/external-resources.html > > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > > > > > > > -- > > Dror Matalon > > Zapatec Inc > > 1700 MLK Way > > Berkeley, CA 94709 > > http://www.zapatec.com > > -- > Dror Matalon > Zapatec Inc > 1700 MLK Way > Berkeley, CA 94709 > http://www.zapatec.com > > __________________________________________________________________________ > _ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html -- It is the strict policy of Truworths that its e-mail facility and all e-mail communications emanating therefrom, should be utilised for business purposes only and should conform to high professional and business standards. Truworths has stipulated certain regulations in terms whereof strict guidelines relating to the use and content of e-mail communications are laid down. The use of the Truworths e-mail facility is not permitted for the distribution of chain letters or offensive mail of any nature whatsoever. Truworths hereby distances itself from and accepts no liability in respect of the unauthorised use of its e-mail facility or the sending of e-mail communications for other than strictly business purposes. Truworths furthermore disclaims liability for any unauthorised instruction for which permission was not granted. Truworths Limited accepts no liability for any consequences arising from or as a result of reliance on this message unless it is in respect of bona fide Truworths business for which proper authorisation has been granted. Any recipient of an unacceptable communication, a chain letter or offensive material of any nature is requested to notify the Truworths e-mail administrator ([EMAIL PROTECTED]) immediately in order that appropriate action can be taken against the individual concerned. ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html