在Chrome扩展程序中拦截AJAX响应 [英] Intercept AJAX responses in Chrome Extension
问题描述
我们正在现有系统之上构建一个Chrome扩展,以帮助完成一些任务。
这是AJAX强烈的,它会比抓取html和触发事件来拦截一些AJAX响应。
$ b 例子: =https://i.stack.imgur.com/JUxFw.pngalt =在这里输入图片描述>
Chrome扩展程序如何获得该功能JSON?
我试过 WebRequest 但它似乎不允许做到这一点。 如果您不介意使用 jQuery ,您可以使用
$。ajaxComplete(function(Event event,jqXHR jqXHR,PlainObject ajaxOptions))
文档上的方法。
你可以抓住所有的t他有关任何事件的信息并相应记录。
http://api.jquery.com/ajaxcomplete /
We're building a chrome extension on top of an existing system, to help with a few tasks.
It's AJAX intense and it would be far more efficient than scraping html and triggering events to intercept some of the AJAX responses.
Example: Frome chrome console, networks tab, you see the beautiful JSON:
How can a Chrome Extension get to that JSON ?
I've tried WebRequest but it appear it does't allow to do this.
If you don't mind using jQuery, you can use the
$.ajaxComplete( function( Event event, jqXHR jqXHR, PlainObject ajaxOptions ))
method on the document.
In the callback you can grab all of the information about any of the events and log them accordingly.
http://api.jquery.com/ajaxcomplete/
这篇关于在Chrome扩展程序中拦截AJAX响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!