跨越受保护的 grepmonkey 执行空间和 unsafeWindow 空间之间边界的问题
这是我的问题: 我已将一些回调注册到雅虎事件驱动的网页(betfair.com 市场视图)中,并使用处理程序捕获betsPlaced 事件。
到目前为止就这么简单。
下一阶段是将事件返回到greasemonkey land,虽然我知道从greasemoney space你可以调用unsafeWindow.stuff,但没有反向操作(按设计)。
因此,如果我想通过 cometd 队列发送事件的内容,我精心设置的 jquery、greasemonkey、YUI2、betfair 环境会失败,告诉我 unsafeWindow 进程无法调用 GM_ajax 内容。这显然是安全和理智的,但它基本上阻止了我做我想做的事情。
有没有人尝试这样做(忽略 cometd 的东西,只是一般的 ajax 调用)并成功了?
我看过这样的页面: http://wiki.greasespot.net/0.7 .20080121.0%2B_兼容性 但它似乎并不适用于所有呼叫。
Here is my problem:
I've registered some callbacks into a Yahoo event driven webpage (betfair.com market views) and am trapping the betsPlaced events with a handler.
So far so simple.
Next stage is to get the event back into greasemonkey land, and while I know that from greasemoney space you can call unsafeWindow.stuff, there is no reverse operation (by design).
So if I want to send the contents of the event over, say, a cometd queue, my carefully set up jquery, greasemonkey, YUI2, betfair environment fails by telling me that unsafeWindow processes cant call GM_ajax stuff. This is obviously safe and sane, but it basically stops me doing what I want to do.
Has anyone tried doing this (ignore the cometd stuff, just general ajax calls) and succeeded?
I've had a look at pages like this: http://wiki.greasespot.net/0.7.20080121.0%2B_compatibility
but it doesnt appear to work for all the calls.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这对我来说似乎不太清楚。为什么不能使用
addEventListener()
、preventDefault()
、stopPropagation()
等从 GM 端捕获事件?无论如何,最坏的情况,你就不能做这样的事情吗?
This doesn't seem clear to me. Why can't the events be trapped from the GM end using
addEventListener()
,preventDefault()
,stopPropagation()
, etc?Anyway, worst case, can't you do something like this?
使用 setTimout 作为您在 Greasespot wiki 中链接到的页面所解释的,应该可以工作,我猜您错误地实现了解决方法。
Using a setTimout as that page you linked to in the Greasespot wiki explains, should work, I'm guessing you implemented the work around incorrectly.