javascript - How do I console.log POST requests with my chrome extension -
i'm trying console.log post requests chrome extension can't figure out how it, can give me example? i've looked @ chrome extension api still can't seem it
in google chrome, browser requests such post
, get
visible in network
tab of inspector.
screenshot chrome devtools overview:
if looking natural way make javascript hook on browser requests (such logging them out), have more issues there no native way javascript hook on requests @ browser's scale, security reasons.
but if okay use dedicated extension job, can @ webrequest
extension chrome:
https://developer.chrome.com/extensions/webrequest
use chrome.webrequest api observe , analyze traffic , intercept, block, or modify requests in-flight.
here's example of listening onbeforerequest
event:
chrome.webrequest.onbeforerequest.addlistener(callback, filter, opt_extrainfospec);
beware, there security requirements , limitations:
you must declare "webrequest" permission in
extension manifest
use web request api, along host permissions hosts network requests want access.
note due ordered or asynchronous nature of webpage resources loading (http/1.x or http/2.0) not guaranteed catch all requests made browser happened before javascript hooks setup.
eventually, have tricks, such those referenced here detecting ajax calls through javascript proxification mechanisms.
another strategy have request detection deported on server , informing client sent request (through websockets/queues example). work requests targeted on domains manage though, , sounds bit of expensive solution. depends of ultimate needs are.
Comments
Post a Comment