What percentage of subsequent hyperlinks could ignore their onclick JavaScript?

As far as I know, all popular web browsers start the onclick attribute of the bindings first, then follow the path indicated by the href attribute.

The problem is that the onclick attribute is only called when left-clicking (without pressing the ctrl or shift key for a new tab or window) or when you press enter on the keyboard, while tabIndex is set to the desired link to follow.

But there are many other ways to use links than just these two.

  • ctrl + click
  • shift + click
  • rightmousebutton + open
  • rightmousebutton + new tab
  • drag the link to the address bar

etc.

My client uses onclick for conversion statistics. Which seems badly unreliable.

: onclick?

. ; , ...

+3
4

, /ctrl -click, , onClick: NoScript , javascript , . , onClick , , .

, , : -.

, , , , , , , , javascript.

+5

. , , . , , , , , . , , .

+1

onclick, , ? ... onclick -... , , (, CTRL + Click), , )

"" / , , , onmousedown/up focus/blur .

0

- exit. PHP script, .

, , Google Analytics. , . ( " " , , , ), Ajax- http://www.google.com/url.

Analytics : Adblock .. , - google.com Live HTTP Headers Firefox ( Firebug Net Firefox WebKit Resources Safari Chrome, ). , , ( , HTTP- ).

onclick ( Ctrl )

. JS Bin, , - onclick. ( oncontextmenu.)

0
source

Source: https://habr.com/ru/post/1719602/


All Articles