Find out whether users uses the contextmenu to open a link

Go To StackoverFlow.com

0

For my site I need to find out if a user navigates to a link on my page. 'Normal' clicks can be easily captured, however I also want to find out if the user uses the contextmenu on a link to navigate to an URL.

I know I can find out when the user does a right mouse button click (contextmenu), but I have no idea how to find out whether the user navigates to the link after that (e.g. clicks on 'open in new tab').

Is it even possible to do? Or perhaps there is some other method of finding out when the user navigates to an URL on the page?

2012-04-04 22:47
by PeeHaa
Why isn't looking at the refer header suitable - Incognito 2012-04-04 23:23
I'm talking about trapping outbound links. Or am I misunderstanding you - PeeHaa 2012-04-04 23:24


0

You can do what facebook/google and others do, ensure all outbound links go through your own internal refer/log, ie:

http://example.com/r=http://someSite.example.com/foobar...

There's no assurances you can do anything better than this with javascript, but you can bind a function to listen in on link clicks with the second-mouse-button, and set up some hackish ensure-other-page-loads-eventually mechanism with server-side code, but that's just way out there and I'd highly advise against that.

Just stick with the thing google/facebook does, everything else is a cheap unstable hack that isn't worth the effort.

2012-04-04 23:28
by Incognito
Ads