Javascript bookmarklet在某些网站上失败,创建了ghostly new< html>页 [英] Javascript bookmarklet fails on certain sites, creates ghostly new <html> page

查看:90
本文介绍了Javascript bookmarklet在某些网站上失败,创建了ghostly new< html>页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的Javascript bookmarklet在Google Reader和Google搜索结果页面等某些网站上失败(在某些非Google网站上随机发布)。看一下控制台,我可以看到,对于这些页面,单击书签并没有像往常一样将元素附加到头部/主体,而是创建了一个如下所示的新文档:

I noticed that my Javascript bookmarklet was failing on certain sites like Google Reader and Google search results pages (and randomly on some non-Google sites). Looking at the console, I could see that, for these pages, clicking the bookmarklet did not append elements to the head/body like it normally did, but created a new document that looked like this:

<html>
  <head></head>
  <body></body>
</html>

即使我将书签缩小为 javascript:alert(window.location。 href); 它会创建这个空白页面并在其中运行书签,以便警告显示 about:blank 。在大多数网站上,不会创建此空白页面并显示正确的位置。

Even when I reduced my bookmarklet to javascript:alert(window.location.href); it would create this blank page and run the bookmarklet therein, so that the alert showed about:blank. On most sites, this blank page is not created and the correct location is shown.

有人可以解释一下吗?这些网站是否在沙箱外部运行代码作为安全措施?

Can someone explain this? Are these sites sandboxing externally run code as a safety measure?

更新:我目前无法在Chrome 17.0以外的浏览器上重现这一点。 932.0 dev。如果其他人可以在Chrome或其他方面重现这些结果,请与我们联系。

UPDATE: I currently can't reproduce this on browsers other than Chrome 17.0.932.0 dev. Please let me know if anyone else can reproduce these results on Chrome or otherwise.

推荐答案

我认为这是Google Chrome中的一个错误,我已将其提交到他们的错误数据库: https://bugs.webkit.org/ show_bug.cgi?id = 72606

I think this is a bug in Google Chrome, I've filed it to their bug database: https://bugs.webkit.org/show_bug.cgi?id=72606

这篇关于Javascript bookmarklet在某些网站上失败,创建了ghostly new&lt; html&gt;页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆