Is it possible to detect if a page is opened in 2 different browsers?
I have built an small app, that stores some data in $_SESSION, and the problem is that when multiple tabs gets opened, the session vars gets overwritten (search filters in a search form) and so the tabs may display the same results for apparently different searches.
The main browser used for this app is IE, so it took a while to hit this problem and the app got ..larger and harder to modify.
Until i fix all the references to this search, i would like to do a "quick & dirty fix" and deny opening two tabs with the same page,or at least display a warning..
@arjun: yes, i know, but i have to restore the search filters when the user return to the search page:) so $SESSION is the way to go for this. Also, the filters are sent down by AJAX and it gets hard to debug when you have lots of filters(GET is limited in size, so i use POST)
@tomhaigh: thx..but this is what i'm trying to do right now, but this will take a while because this tab "thing" affects the whole app, and i have to change the filters in all modules... i was looking for something quick&dirty for now. Tip: i dont want to use time() and rand() as theese functions can (and eventually will) generate duplicate numbers. In the new "rewrite" i use microtime from PHP and Date.getTime() in JS and concatenate theese 2 to generate a truly unique id. Also, i wrote a function to parse the SESSION from time to time and cleanup stored filters older than 2 hours so it wont grow too big.
@Gortok: i know..but is was designed with IE6 in mind and most of the users (something like 90%) still use IE6 while logging into this app... so i never saw the need to consider multiple open tabs.
posted date: 2008-12-28 17:26:00