从书签调用原始的未受干扰的 window.open
我有通用书签,其开头为:
javascript:with (window.open("")) {/* lots of irrelevant characters */
它按应有的方式工作(特别是打开新窗口并编写有关页面元素的报告),但是当作者决定什么 open
是好的时,在某些页面上会失败函数名称:
/* somewhere in global scope */
function open() { /* something */ }
... 有效地替换 window.open
并破坏小书签操作。由于小书签的性质,我无法采取任何措施来防止这种不当行为。
在这种情况下有什么办法可以调用原始的原生window.open
来恢复吗? 请注意,我的主要浏览器是 Opera,我真的想让它在那里工作。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,抱歉。不过,您可以做一些黑客操作来获得一个新的:)var ifr = document.createElement('iframe');
document.body.appendChild(ifr);
ifr.contentWindow.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(...)