blankshield.js
function clickListener(e) {
    var target, targetName, href, usedModifier;

    // Use global event object for IE8 and below to get target
    e = e || window.event;
    // Won't work for IE8 and below for cases when e.srcElement
    // refers not to the anchor, but to the element inside it e.g. an image
    target = e.currentTarget || e.srcElement;

    // Ignore anchors without an href
    href = target.getAttribute('href');
    if (!href) return;

    // Ignore anchors without an unsafe target or modifier key
    usedModifier = (e.ctrlKey || e.shiftKey || e.metaKey);
    targetName = target.getAttribute('target');
    if (!usedModifier && (!targetName || safeTarget(targetName))) {
      return;
    }

    blankshield.open(href);

    // IE8 and below don't support preventDefault
    if (e.preventDefault) {
      e.preventDefault();
    } else {
      e.returnValue = false;
    }

    return false;
  }
function clickListener(e) {
    var target, targetName, href, usedModifier;

    // Use global event object for IE8 and below to get target
    e = e || window.event;
    // Won't work for IE8 and below for cases when e.srcElement
    // refers not to the anchor, but to the element inside it e.g. an image
    target = e.currentTarget || e.srcElement;

    // Ignore anchors without an href
    href = target.getAttribute('href');
    if (!href) return;

    // Ignore anchors without an unsafe target or modifier key
    usedModifier = (e.ctrlKey || e.shiftKey || e.metaKey);
    targetName = target.getAttribute('target');
    if (!usedModifier && (!targetName || safeTarget(targetName))) {
      return;
    }

    blankshield.open(href);

    // IE8 and below don't support preventDefault
    if (e.preventDefault) {
      e.preventDefault();
    } else {
      e.returnValue = false;
    }

    return false;
  }
function clickListener ( e ) { var target , targetName , href , usedModifier ; // Use global event object for IE8 and below to get target e = e || window . event ; // Won't work for IE8 and below for cases when e.srcElement // refers not to the anchor, but to the element inside it e.g. an image target = e . currentTarget || e . srcElement ; // Ignore anchors without an href href = target . getAttribute ( 'href' ) ; if ( ! href ) return ; // Ignore anchors without an unsafe target or modifier key usedModifier = ( e . ctrlKey || e . shiftKey || e . metaKey ) ; targetName = target . getAttribute ( 'target' ) ; if ( ! usedModifier && ( ! targetName || safeTarget ( targetName ) ) ) { return ; } blankshield . open ( href ) ; // IE8 and below don't support preventDefault if ( e . preventDefault ) { e . preventDefault ( ) ; } else { e . returnValue = false ; } return false ; }
An event listener that can be attached to a click event to protect against
reverse tabnabbing. It retrieves the target anchors href, and if the link
was intended to open in a new tab or window, the browser's default
behavior is canceled. Instead, the destination url is opened using
"window.open" from an injected iframe, and the iframe is removed. Except
for IE < 11, which uses "window.open" followed by setting the child
window's opener to null.

@param {Event} e The click event for a given anchor
An event listener that can be attached to a click event to protect against reverse tabnabbing . It retrieves the target anchors href and if the link was intended to open in a new tab or window the browser s default behavior is canceled . Instead the destination url is opened using window . open from an injected iframe and the iframe is removed . Except for IE < 11 which uses window . open followed by setting the child window s opener to null .