Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
184
rated 0 times [  190] [ 6]  / answers: 1 / hits: 43973  / 15 Years ago, mon, may 11, 2009, 12:00:00

If a user is on your website and opens another link (also to your website) in a new tab, is it possible to differentiate this from the user just clicking on the link normally? This can be in javascript, on the server, whatever.



I'm guessing that the answer is that you cannot do this, but I wanted to double check.


More From » tabs

 Answers
88

You can sort of do it like this:



if (history.length == 1) {  // Um, needs to be 0 for IE, 1 for Firefox
// This is a new window or a new tab.
}


There may be other ways for history.length to be 1, but I don't know what they might be.


[#99558] Wednesday, May 6, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyreek

Total Points: 421
Total Questions: 115
Total Answers: 102

Location: Marshall Islands
Member since Mon, May 31, 2021
3 Years ago
;