I am trying to implement a system to mask affiliated links
of a web page. I can handle user's right click with
oncontextmenu event and mask the link without any problem
but when user cancels context menu, link value is been
changed.

Code:
link.oncontextmenu = function () {
  link.href = "http://......";          
}
I cannot find a way to handle when user cancel...