And if the user clones the window as the originator of this thread
postulated, will that name property still contain our identifier? No.
Of course not. That is /exactly/ what makes "cloned" windows _different_
from "original" windows. Which is /exactly/ what the OP wants.
It would probably help the cause of enlightenment if you remembered the
original question instead of inventing your own.
Pot, kettle, black. The OP wants to recognize different browser windows,
and create a new server-side session for each new window:
,-<|
| I dont want one window to be aware of the other one.. All I want from
| the script is to tell some surrogate value of the window identity. This
| could be just raw address.
| [...]
,-<|
| > Therefore, you refer me to the session variable in JSP (which BTW I
| > don't use)? How does JSP/Servlet session behaves when I clone the
| > window? (If they are different then it solves my problem)
|
| Just tested: The session object for the cloned browser window is the
| same:-(
The client-side part of it is really quite simple:
<head>
...
<script type="text/javascript">
// you must obey the rules for window names, set by DOM Level 0, here
if (typeof window.name != "undefined")
{
if (!/^_myWindow/.test(window.name))
{
window.name = "_mywindow" + new Date().getUTCTime();
}
}
</script>
...
</head>
This will assign the Window object a new unique name when the corresponding
window is opened (or "cloned"), and will keep that value if it is
refreshed, or navigation happens in it. And the best part of it is that it
works with tabs, too.[1]
Score adjusted
PointedEars
___________
[1] tested in Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.2)
Gecko/Debian-1.5.dfsg+1.5.0.2-3 Firefox/1.5.0.2