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?