简体   繁体   English

可以检测到书签中的javascript鼠标事件吗?

[英]Possible to detect javascript mouse event in a bookmarklet?

I am specifically looking to get event.screenX and event.screenY - X and Y mouse position on the screen, at the moment a bookmarklet script is triggered. 我特别希望获取event.screenX和event.screenY-书签书签脚本被触发时在屏幕上的X和Y鼠标位置。 Is this possible? 这可能吗?

The bookmarklet opens a new window, which I would like to position at the mouse location. 小书签会打开一个新窗口,我想将其放置在鼠标位置。 Since the bookmarklet could be at any spot along the bookmarks bar, depending on where it is placed, I'd need to get this from the browser/screen. 由于小书签可以位于书签栏的任何位置,具体取决于放置位置,因此我需要从浏览器/屏幕上获取小书签。

I am skeptical that this can be done, but figured I'd ask before completely writing it off. 我对是否可以这样做表示怀疑,但我想我会在完全注销之前问一下。

edit: clarification on what I am trying to achieve. 编辑:澄清我要实现的目标。

Edit: I don't think this is possible, because you would need to receive mouse events outside of the current page's DOM. 编辑:我认为这是不可能的,因为您将需要在当前页面的DOM之外接收鼠标事件。

(The Katamari Hack (http://kathack.com/) is an example of mouse-driven game distributed via bookmarklet. It works on whatever page you're looking at, after you press the bookmarklet, but only captures mouse events inside the DOM. Not that a negative example is proof.) (Katamari Hack(http://kathack.com/)是通过小书签分发的鼠标驱动游戏的示例。按下小书签后,它可在您正在查看的任何页面上运行,但仅捕获鼠标事件DOM。不是一个负面的例子就是证明。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM