Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Javascript PHP jQuery
i have a php site.users opens the site in multiple tabs in same when user in any tab and browsing my site i want to find current tabid of tabinfo by which i can identify current do i do if needed by javascript too? for mozilla,ie,chrome browsers.Any expert asap?
Posted 1-Jan-13 23:45pm
Niral Soni at 2-Jan-13 5:13am
I will be glad if you tell me the reason for such a unique requirement.
mridul samadder at 2-Jan-13 16:15pm
in brief.i need so that i can login and work in each tab as a seperate user.
Karthik. A at 2-Jan-13 16:17pm
Why not simply use different browsers for different users, if this is only for testing purposes?
mridul samadder at 3-Jan-13 6:07am
no there are other requirements

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This seems that you want to test your application with different user(roles) and don't want to get into the repetitive activities like login. It is a good idea to speed up and save time.
But as far as I am aware, this is not possible. Reason is -
1) There is no way of identifying whether the browser supports tabs or not.
2) Even if you found a way to get this, browser window can be opened either as a new tab or as new window. So, your code will not work.
3) Browsers like Google Chrome allows user to drag the tabs to make it as another window, or merge multiple windows into single window with multiple tabs. In such cases, your code will not work.
4) Browsers preserves the session values (eg. login user session ids for same domain) and they are shared across the tabs. So, for the same domain, even if you login as different users in different tabs, the most recent session values (means the login id) will be active. To check this, try to open multiple gmail accounts in multiple tabs. It will always open the account of the most recent logged-in user.
Hence I would prefer to use different browsers for login as different user(roles) and use ALT+TAB key to switch between the open windows.
Hope it helps you out...
If you find a solution for this, please do share with us.
Niral Soni
mridul samadder at 3-Jan-13 14:11pm
dear niral
thank you!.As client wants it so what can i do.i found a way '' property is unique per tab in a i am trying to use it..will there be any problem when i assign unique value to when any tab loaded with site to achieve my goal?
Niral Soni at 4-Jan-13 10:32am
You can give it a try. As is mere a JavaScript that runs on client side, the actual problem will arise for maintaining the session values for different users in same browser window with different tabs.
All the best !!!
mridul samadder at 6-Jan-13 14:17pm
no problem.when user comes in a tab i make him relogin if needed for that tab

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 645
1 Maciej Los 225
2 Richard Deeming 160
3 Suvendu Shekhar Giri 159
4 Abhinav S 151
0 Sergey Alexandrovich Kryukov 9,623
1 OriginalGriff 9,135
2 Peter Leow 5,042
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,581

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100