Question: I want to write a bookmarklet that will modify any webpage so that when the JavaScript code on that page does something like `document.location = 'http://site.tld'` or `document.location.href = 'http://site.tld'` the page will open a new tab or window instead of changing location; same as if code was `window.open('http://site.tld')`;

Can I modify the prototype somehow to achieve this goal? (I use this word carelessly because although I've read about modifying prototypes a few times, I've never actually done it.) Or is there some other way?

Answer: 
I was going to suggest using the ES5 [Object.defineProperty](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/defineProperty), but as it should be, document.location is a "configurable: false" object, meaning that it can't be changed. For the curious, if you would be able to change it the code would be like this:

```
Object.defineProperty(document.location, 'href', {
     get: function() { return this.href },
     set: function(value) { this.href = value; window.open(value); return false} //Not sure about this part, but anyways...
});

```

Edit: Answering your question, i don't think that this is achievable via a bookmarlet.
You could only do something with the prototype if it were a function call rather than an assignment. For example in the case of document.write 

```
document.write = function(txt) {
   alert("txt");
};

document.write("test");   

```