Can anyone please tell me how can I detect if user has already opened the link/url tab and is it possible to redirect a link to a active browser tab if the url is already opened?
Eg: User clicks on the link and js code will open a new tab in browser.Now if user again clicks on the link I want him to redirect to the active session instead of opening a new tab.
I read the below post but unable to implement my logic according to them:
Java: ensure web application open only in one browser tab
Possible to detect if a user has multiple tabs of your site open?
I am using simple window.open(url) to open my url in new tab.
Thanks....
Can anyone please tell me how can I detect if user has already opened the link/url tab and is it possible to redirect a link to a active browser tab if the url is already opened?
Eg: User clicks on the link and js code will open a new tab in browser.Now if user again clicks on the link I want him to redirect to the active session instead of opening a new tab.
I read the below post but unable to implement my logic according to them:
Java: ensure web application open only in one browser tab
Possible to detect if a user has multiple tabs of your site open?
I am using simple window.open(url) to open my url in new tab.
Thanks....
Share Improve this question edited May 23, 2017 at 10:25 CommunityBot 11 silver badge asked Jun 27, 2013 at 14:37 PanwarS87PanwarS87 3195 silver badges15 bronze badges 4- I'm pretty sure that would be a privacy violation. Anyway, are those links from the same domain? – MaxArt Commented Jun 27, 2013 at 14:38
- Yes they are for same domain and we are performing SSO to validate so security violation is not a concern. – PanwarS87 Commented Jun 27, 2013 at 14:47
- I said privacy, not security :) I thought you needed to check the client's browser history to perform your task. That's not allowed (anymore). – MaxArt Commented Jun 27, 2013 at 15:38
- oh! yea, sorry about that. But the below solutions worked well for me.I am a newbee in UI, still learning all tips and tricks :) – PanwarS87 Commented Jun 27, 2013 at 16:47
2 Answers
Reset to default 4if you give a name to the opened window it will reopen the same the second time
window.open(url,"mypopup");
use the target/window name in javascript do that
window.open(yoururl, youruniquewindowname)
example
window.open("https://stackoverflow./", "stack_unique_123")
if a window with stack_unique_123, is already open, the "https://stackoverflow./" will be reload in that window, preventing a new one to be open.