I got a mission this week to record all api from function requests in our system. I have finished it, but I still wanna to write a plugin to simplify this work. Well, it maybe does not work well, so just write for fun.
Most project should be included a setting file which is used to describe the whole project base setting such like common properties, version number, etc…
Chrome extension got this file called
permissions field tells the permissions it required and
background field tells the background scripts should be registered.
If u still don’t know what is the above mean, u can just write it down and skip this.
Since we finished the first step, the only info we can infer to is the
background field tell
background.js, let’s write it.
After we bind the chrome tab we can write the real work code and got the error message at runtime.
The follow template shows how to bind listener to the window we created last step and capture the web request.
Network.enable varible which defined by the remote debugging protocol could enable network tracking, and then network events will be delivered to the client.
var tabId = parseInt(window.location.search.substring(1));
onEvent function got three params:
debuggeeId, message, params, u can use them to write what u want.
Here I wanna to record the request log, so I intercept at the
requestWillBeSent, and get the request from the params, get the tab url by using
After last three steps, we can open the extension tab and load from unzip folder which we created, then u can see it.