I have general purpose bookmarklet, which begins with:
javascript:with (window.open("")) {/* lots of irrelevant characters */
It works as should (opens new window and writes a report about page elements, specifically), however fails on certain pages, when authors decide what open
is a good name for function:
/* somewhere in global scope */
function open() { /* something */ }
... effectively replacing window.open
and breaking bookmarklet operation. By the nature of bookmarklet i cannot do anything to prevent such misbehaviour.
Is there any way to call original native window.open
to recover in this 开发者_如何学运维cases?
Please note, my primary browser is Opera, i really want to make it work in there.
window.constructor.prototype.open
Nope, sorry. You can do some hackery to get a new one though :)
var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
ifr.contentWindow.open(...)
精彩评论