JavaScript Ninja - Remove Rude Redirects

Posted at

this snippets is an example on how to remove the rule links that changes the target to a redirection server really-fast,
it could help you protect yourself against clickjacking or save you time waiting for a redirect server to send you the real page. It is a great anti-tracking technique.

  clone - cleans non-attribute event-handlers (it's a nice side effect..)
  removeAttribute - handle the attributes event-handlers

(function(elements, tmp){
'use strict';, function(element){
tmp = element.cloneNode(true);
element.parentNode.replaceChild(tmp, element);

document.querySelectorAll('[onmousedown*="rwt("], [onmousedown*=".href="]')
, null

This code is so-minimal it could easily be placed as a one liner bookmarklet on your bookmarklet toolbar: