Add e.preventDefault()

To debug redirects, it might be worth trying this:
```js
var window = (function() { 
    var img = new Image();
    img.setAttribute('onclick', 'return window;');
    return img.onclick();
})();
window.onbeforeunload = function(e) {
  debugger;
}
```

This branch is off e623e86d62cbcd97099b9cc39b784d58ff365858