Intercept requests through the “JS” extension in Chrome?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
94 views
Good day! Can anyone help, and ideally give examples of the implementation of this mission: "to Intercept the request, to make him cancel, and then its url and headers display on the page like this
You have requested ${url} the URL
With the next headers: ${listOfHeaders}
". Everything is created through the "JS" as the extension by "Chrome".
by | 94 views

2 Answers

0 like 0 dislike
Well, the scheme is almost similar to the proxying techniques
(function () { 'use strict'; var original = { open: XMLHttpRequest.prototype.open, send: XMLHttpRequest.prototype.send }; XMLHttpRequest.prototype.open = function (method, url, async, user, password) { console.log(url); return original.open.call(this, method, url, async, user, password); }; XMLHttpRequest.prototype.send = function (data) { console.log(data); return original.send.call(this, data); }; }());
by
0 like 0 dislike
To intercept HTTP requests, use the webRequest API . This API will allow you to add listeners to the various stages of the HTTP requests. In the audience you can:
  1. to access headers and bodies of the request, to the header response
  2. cancel and redirect requests
  3. to change the request and response headers
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,253 users