Page 1 of 1
unique id of window tab in web browser
Posted: Wed Oct 15, 2008 8:44 pm
by raysleith
i wanna ask if there is a unique id for each window tab in web browser? how to obtain it in php?
my problem is, i wanna redirect people that tracked by $_SESSION. But this will only works if he use one window tab to browse the page.
thanks
Re: unique id of window tab in web browser
Posted: Wed Oct 15, 2008 10:07 pm
by requinix
You can't do that. Find another way.
Re: unique id of window tab in web browser
Posted: Wed Oct 15, 2008 10:56 pm
by raysleith
hm...
any suggestions about technique to redirect url?
or any one know how this devnetwork forum redirect when you have submit a reply then return to the topic?
thanks
Re: unique id of window tab in web browser
Posted: Thu Oct 16, 2008 12:08 am
by requinix
The typical way of redirecting people is to execute
before you've printed anything.
If you explain a little more about what you want to do maybe we'll understand why "this will only works if he use one window tab to browse the page".
Re: unique id of window tab in web browser
Posted: Thu Oct 16, 2008 12:22 am
by alex.barylski
From what I have determined in javascript...tabs do not behave the same as windows at least IE.
I was experiementing with a web desktop I was developing and one of the things I wanted to do was use the desktop system tray icons essentially re-display the tab which represent that application.
While storing the window ID in IE worked as soon as I switched to tab mode the window.setfocus() or whatever function called to bring a window to the front stopped working. I believe I tried this in FF, OP and Safari as well with no success. Kind of bummed me out cause the idea was really neat.
Although technically it makes some sense as a tab, is not nessecarily a "window" in that sense of the word.
Re: unique id of window tab in web browser
Posted: Thu Oct 16, 2008 12:27 am
by raysleith
this is what i'm trying to do
example i would reply a post on topic A, let say with tab 1.
On tab 1, after i reply a topic, it will be redirect to the topic A url.
I do this using session value. This value is saved when i visit topic A.
But in the same time if i want to reply topic A, if theres also opened tab 2 that i would like to reply a post on topic B, the session will be overwritten isnt it?
so the redirection will be failed.
Thanks
Re: unique id of window tab in web browser
Posted: Thu Oct 16, 2008 12:41 am
by alex.barylski
SESSION's are as good as their client side persistence mechanism used...
If SESSION ID's are stored in cookies then tabs will work fine I do this all the time on these boards with no issues...open a topic in a new window and reply that is.
If SID is propagated via GET then opening a new window would require you to pass along the SID with the window.open request.
Re: unique id of window tab in web browser
Posted: Thu Oct 16, 2008 1:08 am
by raysleith
PCSpectra wrote:SESSION's are as good as their client side persistence mechanism used...
If SESSION ID's are stored in cookies then tabs will work fine I do this all the time on these boards with no issues...open a topic in a new window and reply that is.
If SID is propagated via GET then opening a new window would require you to pass along the SID with the window.open request.
i dont understand >.<
is the session id of each tab is different?
here's my example on using the redirection:
topic_detail.php
Code: Select all
<?php
session_start();
$_SESSION['lastURL'] = getThisURL();
?>
<a href='write_reply.php?id=1'>Write reply</a>
write_reply.php
Code: Select all
<?php
session_start();
//do processing...
header("Location: redirect.php");
?>
redirect.php
Code: Select all
<?php
session_start();
if( isset($_SESSION['lastURL']) ){
header("Location:" . $_SESSION['lastURL']);
}
?>
Re: unique id of window tab in web browser
Posted: Thu Oct 16, 2008 2:43 am
by GC Ben
Just read about interesting related technology. I'm sure if you google http Sub-Sessions for different tabs you will find some answers. Url rewriting allows multiple sessions.
Re: unique id of window tab in web browser
Posted: Thu Oct 16, 2008 10:04 pm
by raysleith
i thought about window.name property to handle this problem.
i think, i could assign each tab with unique window.name, that may be generated by timestamp or something.
so i could add session value with prefix + window.name
any suggestions?