Gmail中拦截发送邮件AJAX请求
我正在尝试将回调附加到 Gmail 中的“发送邮件”ajax 操作。我已经能够根据请求负载区分发送邮件操作和其他 AJAX 操作,但无法连接到实际的 AJAX 调用。
到目前为止,我已经尝试使用重写 XMLHttpRequest.open() 方法,详细信息 在这里。那没有用。我还尝试过重写 XMLHttpRequest.send()。也失败了。
有什么想法吗?非常感谢。
I'm trying to attach a callback to the "Send mail" ajax action in Gmail. I've been able to differentiate a Send mail action from other AJAX actions based on the request payload but have been unable to hook into the actual AJAX call.
Thus far, I've tried using overriding the XMLHttpRequest.open() method as detailed here. That hasn't worked. I've also tried overriding XMLHttpRequest.send(). Also failed.
Any thoughts? Much thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Google 的技巧是,他们从具有自己的 JavaScript 环境的 iframe 内部发送请求。但是,由于它是从与父级相同的源加载的,因此您仍然可以轻松地从浏览器控制台操作它:
您可能希望使用 MutationObserver 来可靠地检测新添加的 iframe。
Google's trick is that they send the request from inside an iframe which has it's own JavaScript environment. However, since it is loaded from the same origin as the parent, you can still easily manipulate it even from the browser console:
You might want to use a MutationObserver to detect newly added iframes reliably.