469,343 Members | 5,478 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

windows object identity

Is there a way to tell one window from another? A quick look into wndow
object properties revealed nothing obvious. I want to keep track of
window object identity in a hidden input widget, so that whenever user
clones the window, I'll be able identify this and provide an extra
session.

Apr 22 '06 #1
26 4921
mi*****************@yahoo.com wrote:
Is there a way to tell one window from another?


Sure. If window1 == window2 yields `false', the Window objects referred to
are different, otherwise both references point to the same Window object.
PointedEars
Apr 22 '06 #2

Thomas 'PointedEars' Lahn wrote:
mi*****************@yahoo.com wrote:
Is there a way to tell one window from another?


Sure. If window1 == window2 yields `false', the Window objects referred to
are different, otherwise both references point to the same Window object.


Yes, but the scope is outside of Java Script environment. I want to
save window.id or its equivalent as a text string in a hidden form
widget that can be passed as parameter to servlet/JSP processor. Within
the javascript on page, I prefer not to have any knowledge about the
other browser windows.

Apr 22 '06 #3
Thomas 'PointedEars' Lahn said the following on 4/21/2006 10:51 PM:
mi*****************@yahoo.com wrote:
Is there a way to tell one window from another?


Sure. If window1 == window2 yields `false', the Window objects referred to
are different, otherwise both references point to the same Window object.


You really should learn to read, and comprehend, English before replying
to a lot of the posts you reply to. Had you continued reading, and
comprehended, the context you would have been able to give a better -
more informed - response.

The answer to the question is no. And you are, yet again, showing your
immature pedantic behavior.

Now, go ahead, use your ad hominem defense.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 22 '06 #4
ASM
mi*****************@yahoo.com a écrit :
Yes, but the scope is outside of Java Script environment. I want to
save window.id or its equivalent as a text string in a hidden form
widget that can be passed as parameter to servlet/JSP processor. Within
the javascript on page, I prefer not to have any knowledge about the
other browser windows.


windows names are only known by the file loaded (or at best by the window)

I think that to refer to a (precedent) window.name in a new file loaded
would'nt be abble to work.

Anyway I don't understand why you need to know in witch windows files
are displayed.
Isn't problem of the browser or its user ?

--
Stephane Moriaux et son [moins] vieux Mac
Apr 22 '06 #5
On 2006-04-22 05:12:31 +0200, mi*****************@yahoo.com said:

Thomas 'PointedEars' Lahn wrote:
mi*****************@yahoo.com wrote:
Is there a way to tell one window from another?


Sure. If window1 == window2 yields `false', the Window objects referred to
are different, otherwise both references point to the same Window object.


Yes, but the scope is outside of Java Script environment. I want to
save window.id or its equivalent as a text string in a hidden form
widget that can be passed as parameter to servlet/JSP processor. Within
the javascript on page, I prefer not to have any knowledge about the
other browser windows.


I don't really understand what you intend to do with those IDs.

First, if you want all windows with your site loaded into them to
communicate with each other directly :

Are your extra windows opened by JavaScript (window.open) or do you
want to track any window opened ?

For exemple, if the user manually opens two tabs (or windows) in his
browser and connects to your website on both, a script in one tab will
*never* be able to access the other directly. They could communicate
via the server, or by sharing cookies.

If you care only about window.open'ed windows, then the opener has a
reference to the popup (the value returned by window.open()) and the
popup can use window.opener to access it's opener.

But that has nothing to do with IDs.

Either way you could give a unique ID to each window (that's the
session ID you're already using anyway, so no problem here, just assign
an "id" property to the window if you want to formalize that), but of
course this id cannot be found by getElementById().

If the windows can access each other, then they can read each other's
id property (I still can't begin to guess why you'd want them to do
that). If not, too bad.
--
David Junger

Apr 22 '06 #6
Touffy wrote:
Are your extra windows opened by JavaScript (window.open) or do you
want to track any window opened ?
Cloning new browser window is as simple as "Ctrl-New Window". The end
user may continue his session from a new window as well as the old one.
For exemple, if the user manually opens two tabs (or windows) in his
browser and connects to your website on both, a script in one tab will
*never* be able to access the other directly. They could communicate
via the server, or by sharing cookies.
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.

I'm kind of perplexed. Any OO programming language can output the
reference/pointer to the object. Not in JS?
Either way you could give a unique ID to each window (that's the
session ID you're already using anyway, so no problem here, just assign
an "id" property to the window if you want to formalize that), but of
course this id cannot be found by getElementById().


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)

Apr 24 '06 #7
mi*****************@yahoo.com wrote:
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:-(

Apr 24 '06 #8
mi*****************@yahoo.com wrote:
Touffy wrote:
For exemple, if the user manually opens two tabs (or windows) in his
browser and connects to your website on both, a script in one tab will
*never* be able to access the other directly. They could communicate
via the server, or by sharing cookies.
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.


Each window must have a different name, so you could use the `name' property
of Window objects.
I'm kind of perplexed. Any OO programming language can output the
reference/pointer to the object. Not in JS?


I have already said that you can compare Window object references against
each other, have I not?

But if the user opens the window, there is no reference/pointer to an object
in JS, unless you access the Windows (or whatever) API. Browser windows
are _not_ part of the programming language (they have been, but that was
in the JS-on-NN/IE-only times) but of the Application Object Model the
browser provides. It is your fault not recognizing that, not JS's.
PointedEars
--
Alcohol and Math don't mix. So please don't drink and derive!
Apr 24 '06 #9
Thomas 'PointedEars' Lahn wrote:
Each window must have a different name, so you could use the `name' property
of Window objects.
How? The script

<script>
alert(window.name)
</script>

outputs blank value

If I clone the window, the output doest change.
But if the user opens the window, there is no reference/pointer to an object
in JS, unless you access the Windows (or whatever) API.


OK, failing that, is there other programmtic method to distinguish
between browser windows?

Apr 24 '06 #10
VK

mi*****************@yahoo.com wrote:
OK, failing that, is there other programmtic method to distinguish
between browser windows?


You cannot distinguish between windows from windows themselves. This
possibility was locked from the beginning and it was even more narrowed
over the last decade. The reason is security and privacy reasons, not
technical issues.

In the cloned window script will be initialized over again (current
state is not cloned). Using this you may mark each window onload:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function mark() {
self['$mark'] = (new Date()).getTime();
}
</script>
</head>

<body onLoad="mark()">
<form method="post" action="">
<input type="button" name="b001" value="Button"
onClick="alert(self['$mark'])">
</form>
</body>
</html>

as you see any cloned window has its own $mark value.

But as the current script state is not cloned, the subject of your
concerns is really escaping me. On Ctrl+N user doesn't get a copy of
the current session: it gets a "clear copy" of the page as it was on
the first load.

Apr 24 '06 #11

VK wrote:
mi*****************@yahoo.com wrote:
OK, failing that, is there other programmtic method to distinguish
between browser windows? In the cloned window script will be initialized over again (current
state is not cloned). Using this you may mark each window onload:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function mark() {
self['$mark'] = (new Date()).getTime();
}
</script>
</head>

<body onLoad="mark()">
<form method="post" action="">
<input type="button" name="b001" value="Button"
onClick="alert(self['$mark'])">
</form>
</body>
</html>

as you see any cloned window has its own $mark value.


Unfortunately the timestamp keeps changing every time the page is
reloaded, so it doesn't satisfy the other requrement that windows
identity stays the same during the session in the same browser window.
But as the current script state is not cloned, the subject of your
concerns is really escaping me. On Ctrl+N user doesn't get a copy of
the current session: it gets a "clear copy" of the page as it was on
the first load.


OK, that is minor terminology snag. Ctrl+N copies over the application
state of the browser window minus Java Script state (which isn't the
issue for my application anyway).

Apr 24 '06 #12
VK

mi*****************@yahoo.com wrote:
Unfortunately the timestamp keeps changing every time the page is
reloaded, so it doesn't satisfy the other requrement that windows
identity stays the same during the session in the same browser window.
You cannot bulletproof track down separate windows. You may identify
*clients* by cookies (if enabled). This is one of "disconveniences" of
the Web same as you cannot search on local drives or write from the
browser right to the local file (I'm talking about the default
circumstances). Hugely disconvenient :-) - but WONTFIX.

If your solution is absolutely dependant on proper windows tracking, it
simply means that it is not a Web solution. You either have to choose
an appropriate Web solution, or write a web-enabled executable to
destribute to your clients. As simple as that.

Ctrl+N copies over the application
state of the browser window minus Java Script state (which isn't the
issue for my application anyway).


On each Ctrl+N your script will call onload handler in the new window.
You can mark the new window, ajax some data to the server, adjust
cloned form field values - whatever. So I'm still missing the technical
problem.

No, you cannot have 100% guarantee that each new window case will be
tracked and properly reported. If it's a must, then see the first part
of this post.

Apr 24 '06 #13
mi*****************@yahoo.com wrote:
Thomas 'PointedEars' Lahn wrote:
Each window must have a different name, so you could use the `name'
property of Window objects.
How? The script

<script>


.... lacks the required `type' attribute:

<script type="text/javascript">
alert(window.name)
</script>

outputs blank value
Lucky you!
If I clone the window, the output doest change.


Well, you could set the property ...
But if the user opens the window, there is no reference/pointer to an
object in JS, unless you access the Windows (or whatever) API.


OK, failing that, is there other programmtic method to distinguish
between browser windows?


I don't know any.
PointedEars
--
#define QUESTION ((bb) || !(bb))
// William Shakespeare (if he would have been a hacker ;-))
Apr 25 '06 #14

mi*****************@yahoo.com wrote:
Is there a way to tell one window from another? A quick look into wndow
object properties revealed nothing obvious. I want to keep track of
window object identity in a hidden input widget, so that whenever user
clones the window, I'll be able identify this and provide an extra
session.

As you've probably deduced by now, within the javascript environment,
there is no way to identify browser windows. What I and my colleagues
ended up doing was asking an ActiveX control for the window handle (IE
only of course but unfortunately that is the requirement for this
software). Then we stored the handle in a session cookie. It's
incredibly complex but we can now do many things that ASP sessions did
not let us do.

A truly limitied answer and probably not helpful at all but a nice
break from the guru fight.

Bob Gulian

Apr 25 '06 #15
bg*****@gmail.com wrote:
mi*****************@yahoo.com wrote:
Is there a way to tell one window from another? A quick look into wndow
object properties revealed nothing obvious. I want to keep track of
window object identity in a hidden input widget, so that whenever user
clones the window, I'll be able identify this and provide an extra
session.
As you've probably deduced by now, within the javascript environment,
there is no way to identify browser windows.


Yes, there is. As I said, provided that we assume that the `name' property
of new Windows is empty or does simply not match "our" format, it is
possible to set that property with string format containing a unique value
(new Date().getTime() comes to mind), and thereby identify the browser
window (at least the Window object we are working with; that may be a tab,
too).
A truly limitied answer and probably not helpful at all but a nice
break from the guru fight.


The ability to draw meaning from posted text can be an important advantage
around here. So much for "guru fight".
PointedEars
--
Homer: I have changed the world. Now I know how it feels to be God!
Marge: Do you want turkey sausage or ham?
Homer: Thou shalt send me *two*, one of each kind.
(Santa's Little Helper [dog] and Snowball [cat] run away :))
Apr 25 '06 #16
Thomas 'PointedEars' Lahn said the following on 4/25/2006 11:43 AM:
bg*****@gmail.com wrote:
mi*****************@yahoo.com wrote:
Is there a way to tell one window from another? A quick look into wndow
object properties revealed nothing obvious. I want to keep track of
window object identity in a hidden input widget, so that whenever user
clones the window, I'll be able identify this and provide an extra
session. As you've probably deduced by now, within the javascript environment,
there is no way to identify browser windows.


Yes, there is.


No there isn't.
As I said, provided that we assume that the `name' property of new Windows
And if the name property isn't set then it means nothing to you and
breaks your "scheme".
is empty or does simply not match "our" format, it is
possible to set that property with string format containing
a unique value (new Date().getTime() comes to mind), and
thereby identify the browser window (at least the Window
object we are working with; that may be a tab, too).


"it is possible"? Is that your way of defending your ludicrous idea?
When someone says it doesn't work, you can reply that you said "It is
possible"?

But guess what Mr PointedEars? If the page is opened in a new *tab* then
you have no new *window* to deal with. Do you lack the ability to
recognize the difference? Obviously not.
A truly limitied answer and probably not helpful at all but a nice
break from the guru fight.


The ability to draw meaning from posted text can be an important advantage
around here. So much for "guru fight".


Yes, and your ability to draw the *proper* meaning from the English
language have been proven to be faulty at best so what you "draw
meaning" from doesn't mean a whole lot.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 25 '06 #17

Thomas 'PointedEars' Lahn wrote:
bg*****@gmail.com wrote:
As you've probably deduced by now, within the javascript environment,
there is no way to identify browser windows.


Yes, there is. As I said, provided that we assume that the `name' property
of new Windows is empty or does simply not match "our" format, it is
possible to set that property with string format containing a unique value
(new Date().getTime() comes to mind), and thereby identify the browser
window (at least the Window object we are working with; that may be a tab,
too).


And if the user clones the window as the originator of this thread
postulated, will that name property still contain our identifier? No.
It would probably help the cause of enlightenment if you remembered the
original question instead of inventing your own.
Bob Gulian

Apr 26 '06 #18
bg*****@gmail.com wrote:
Thomas 'PointedEars' Lahn wrote:
bg*****@gmail.com wrote:
> As you've probably deduced by now, within the javascript environment,
> there is no way to identify browser windows.
Yes, there is. As I said, provided that we assume that the `name'
property of new Windows is empty or does simply not match "our" format,
it is possible to set that property with string format containing a
unique value (new Date().getTime() comes to mind), and thereby identify
the browser window (at least the Window object we are working with; that
may be a tab, too).


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:

,-<news:11**********************@g10g2000cwb.googleg roups.com>
|
| 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.
| [...]

,-<news:11**********************@i39g2000cwa.googleg roups.com>
|
| > 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
--
What one man can invent another can discover.
-- Sherlock Holmes in Sir Arthur Conan Doyle's
"The Adventure of the Dancing Men"
Apr 26 '06 #19
bg*****@gmail.com wrote:
Thomas 'PointedEars' Lahn wrote:
bg*****@gmail.com wrote:
> As you've probably deduced by now, within the javascript environment,
> there is no way to identify browser windows.
Yes, there is. As I said, provided that we assume that the `name'
property of new Windows is empty or does simply not match "our" format,
it is possible to set that property with string format containing a
unique value (new Date().getTime() comes to mind), and thereby identify
the browser window (at least the Window object we are working with; that
may be a tab, too).


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:

,-<news:11**********************@g10g2000cwb.googleg roups.com>
|
| 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.
| [...]

,-<news:11**********************@i39g2000cwa.googleg roups.com>
|
| > 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().getTime();
}
}
</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
--
What one man can invent another can discover.
-- Sherlock Holmes in Sir Arthur Conan Doyle's
"The Adventure of the Dancing Men"
Apr 26 '06 #20

bg*****@gmail.com wrote:
Thomas 'PointedEars' Lahn wrote:
bg*****@gmail.com wrote:
As you've probably deduced by now, within the javascript environment,
there is no way to identify browser windows.


Yes, there is. As I said, provided that we assume that the `name' property
of new Windows is empty or does simply not match "our" format, it is
possible to set that property with string format containing a unique value
(new Date().getTime() comes to mind), and thereby identify the browser
window (at least the Window object we are working with; that may be a tab,
too).


And if the user clones the window as the originator of this thread
postulated, will that name property still contain our identifier? No.
It would probably help the cause of enlightenment if you remembered the
original question instead of inventing your own.


Upon furthur investigation it looks like I shot off my mouth too soon.
Thomas is correct. The window.name retains the value you give it upon
refresh. It is a perfectly reasonable way to uniquely identify windows
and be able to read that identification at any time.

I apologize for my comment. I let the urge to correct you for the way
you say things prevail nstead of listening to what you were actually
saying.

Bob Gulian

Apr 26 '06 #21
> <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().getTime();
}
}
</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]


Nice try. Doesn't work. JSP page code:

<html>
<head>
<title>Test Window</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<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().getTime();
}
}
</script></head>

<body>
<form method="post" action="">
<input type="button" name="b001" value="Button"
onClick="alert(window.name);submit()">
</form>
</body>
Session Id is <%= session.getId()%>

</html>

The name of the window keeps changing whenever I press the button.

Let me again state the requirements:
1. If I navigate pages in the same browser window, the session (aka
"window identity") stays the same. Ditto for navidating with browser
"go back/forward one page".

2. If window is cloned, the identity should change. Ditto for browser
tabs.

BTW, CTRL-N doesn't clone window in Mozilla (it invokes new windoe with
the default page). Am I missing some setting?

Apr 26 '06 #22
mi*****************@yahoo.com wrote:
Let me again state the requirements:
1. If I navigate pages in the same browser window, the session (aka
"window identity") stays the same. Ditto for navidating with browser
"go back/forward one page".

2. If window is cloned, the identity should change. Ditto for browser
tabs.


The last sentence indicates that I focus on session management, not
window identity. What is the session definition? Session is some linear
sequence of pages that user can navigate back in forth in time. Any
time a web page gets cloned into a new tab or browser window, a new
session is spawned. This is a new session because the old one is still
present and there is no way to merge the new session into the old one.

Now the question: how do I manage the session on client side?
Apparently, without client support server side has no way to manage
sessions. (This strikes me as an extremely odd idea that JSP/Servlet
session concept -- which is about 10 years old concept -- is something
defferent from what I just described).

Apr 26 '06 #23
mi*****************@yahoo.com wrote:
<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().getTime();
}
}
</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]
Nice try. Doesn't work.


Yes, it does. ("Does not work" is a useless error description. [psf 4.11])
JSP page code:
[...]
<form method="post" action="">
<input type="button" name="b001" value="Button"
onClick="alert(window.name);submit()">
It should be `this.form.submit();', if that.
</form>
[...]
The name of the window keeps changing whenever I press the button.
Confirmed. The reason was that I had disregarded letter case (and did not
look for a case-insensitive match). Therefore, the Regular Expression did
not match.

However, the name is not changed with the (in contrast to your code) Valid
markup[1]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Test Window</title>

<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
if (typeof window.name != "undefined")
{
if (!/^_myWindow/.test(window.name))
{
window.name = "_myWindow" + new Date().getTime();
}
}
</script>
</head>

<body>
<form action="" method="post">
<input type="submit" name="b001" value="Submit">
<script type="text/javascript">
document.write(window.name);
</script>
</form>

Session Id is ...
</body>
</html>
Let me again state the requirements:
1. If I navigate pages in the same browser window, the session (aka
"window identity") stays the same. Ditto for navidating with browser
"go back/forward one page".

2. If window is cloned, the identity should change. Ditto for browser
tabs.
If I "Duplicate" the window in IE6 SP1 on Win2k SP4 (with .NET 1.1
support) with C-N, or the window or tab with Tabbrowser Extensions in
Firefox/1.5.0.2, in Opera/9 Beta, and in Konqueror/3.52, the window
name definitely changes.[1] With the above correction, it does not
if I refreshed the document or navigated in that window afterwards,
including submit to the same document resource.

However, if your "cloning" for some reason "clones" the window name
as well, I am afraid you are out of luck.
BTW, CTRL-N doesn't clone window in Mozilla (it invokes new windoe with
the default page). Am I missing some setting?


Mozilla SeaMonkey Suite[1] has a setting to define what should happen if
a new window/tab is opened by the user (with C-N or otherwise); you would
have to set "Edit/Preferences/Navigator/Display on New Window|Tab" to "Last
page visited". Mozilla Firefox apparently misses either that preference or
the corresponding UI, and simply does not clone by default. Neither do
Opera or Konqueror then.

Please _always_ provide attribution of quoted material.
PointedEars
___________
[1] <URL:http://validator.w3.org/>
[2] (Unforged) UA header strings:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)

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

Opera/9.00 (X11; Linux i686; U; en)

Mozilla/5.0 (compatible; Konqueror/3.5; Linux
2.6.15.6-20060314.201202+0100; X11; i686; de, en_US)
KHTML/3.5.2 (like Gecko) (Debian package 4:3.5.2-2+b1)
--
What one man can invent another can discover.
-- Sherlock Holmes in Sir Arthur Conan Doyle's
"The Adventure of the Dancing Men"
Apr 26 '06 #24
VK

mi*****************@yahoo.com wrote:
What is the session definition? Session is some linear
sequence of pages that user can navigate back in forth in time. Any
time a web page gets cloned into a new tab or browser window, a new
session is spawned. This is a new session because the old one is still
present and there is no way to merge the new session into the old one.


That is the most odd session definition I've ever seen so far (and I
saw a lot of odd things). Session (from the server point of view) is
the moment of the first request for a transaction and till the moment
of the final request finishing the transaction. If it's a multi-step
transaction, on the first request your create an unique session ID and
a session record/file to keep the intermediate submission data. On each
new request you check these data and if the session is not expired and
credentials (if any) are in order you serve the next step page. You
cannot control how did the current request came to you: from the
original browser window, or user cloned it in 25 copies and submitting
from from each of them, or refreshing the window, or she reverse
engineered your form and using XMLHttpRequest with timed loop. These
are just very tops of things a "curious" user may do. If you are really
so concerned about transactions stability, then the matter is way above
of JavaScript domain and any "window identification" cheat-chat. You
need first to program the decisions server-side:
1) how long the session is kept before marked expired.
2) if transaction record stopped on step 5 and next request came for
step 2, are you serving step 2 with roll-back data or will you say
"sorry Joe, no way"
3)
4)
5)
....
33)
....
Some good book about transaction server could be really helpful here.

Apr 26 '06 #25
VK wrote:
mi*****************@yahoo.com wrote:
What is the session definition? Session is some linear
sequence of pages that user can navigate back in forth in time. Any
time a web page gets cloned into a new tab or browser window, a new
session is spawned. This is a new session because the old one is still
present and there is no way to merge the new session into the old one.


That is the most odd session definition I've ever seen so far (and I
saw a lot of odd things). Session (from the server point of view) is
the moment of the first request for a transaction and till the moment
of the final request finishing the transaction. If it's a multi-step
transaction, on the first request your create an unique session ID and
a session record/file to keep the intermediate submission data. On each
new request you check these data and if the session is not expired and
credentials (if any) are in order you serve the next step page. You
cannot control how did the current request came to you: from the
original browser window, or user cloned it in 25 copies and submitting
from from each of them, or refreshing the window, or she reverse
engineered your form and using XMLHttpRequest with timed loop. These
are just very tops of things a "curious" user may do. If you are really
so concerned about transactions stability, then the matter is way above
of JavaScript domain and any "window identification" cheat-chat. You
need first to program the decisions server-side:
1) how long the session is kept before marked expired.
2) if transaction record stopped on step 5 and next request came for
step 2, are you serving step 2 with roll-back data or will you say
"sorry Joe, no way"
3)
4)
5)
...
33)
...
Some good book about transaction server could be really helpful here.


Crossposting to comp.java.lang.programmer where server side discussion
is on the way...

To clarify, the application is a SQL workbench. A user enters SQL
statement in a form, submits the request, and gets nicely formatted
result in the next page. He enters new query there, and so on.

Therefore, the session that I want to maintain on server is JDBC
connection. Now among all the obvious things that I do on middle tier
-- connection pooling, connection timeouts -- I have to define client
session too. Otherwise, every new SQL query would create a new JDBC
connection.

There is no transaction spanning multiple pages. Each query is a
transaction. A SQL command history is the browser history. A user can
navigate with the browser back button to the commands he entered early.
This is why the session is the sequence of pages.

Apr 26 '06 #26
> If I "Duplicate" the window in IE6 SP1 on Win2k SP4 (with .NET 1.1
support) with C-N, or the window or tab with Tabbrowser Extensions in
Firefox/1.5.0.2, in Opera/9 Beta, and in Konqueror/3.52, the window
name definitely changes.[1] With the above correction, it does not
if I refreshed the document or navigated in that window afterwards,
including submit to the same document resource.


As I'm duplicating the window with Ctrl-N, your solution works for me.
Thanks.

Apr 26 '06 #27

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Nathan Kovac | last post: by
10 posts views Thread by newbie | last post: by
11 posts views Thread by Eric | last post: by
4 posts views Thread by =?Utf-8?B?QXZhRGV2?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.