Answer the question
In order to leave comments, you need to log in
How can a javascript function be intercepted?
Hello I am new to js programming. The question arises, js code is executed in the browser, so it means that you can intercept certain functions and change the response? That is, there is a site that, using js, takes some information about my browser (user agent, fonts, list of plugins, etc.). Does this mean that I can create my own script and force my browser to intercept these requests and replace the results. For example, let them intercept the user agent , send it to the server and, based on this, send those who use opera to one site, those who use mozilla to another (or another js on the site performs sorting without using the server). Is it possible to implement the interception of this function and substitution, so that a request is sent from Mozilla with the result that they say the opera and the server sent me to the site for the opera. If yes,
PS the example is rough and perverted, I know that it is possible to replace UA with plugins, etc., but I'm interested in the possibility of solving such problems, by intercepting and replacing js.
Answer the question
In order to leave comments, you need to log in
Yes, in the general case, you can replace the script of a certain site with your own, modified script. But if the authors of this site are seriously afraid of such substitutions, they can check if their script has been changed. Well type md5(someFunction.toString()) and send that info too. And if they expect a unique hash each time, it will be quite difficult for you to make a substitution.
In any case, it's easier to do this through browser settings and plugins. If interested, read about the tor browser, and at the same time about all sorts of whonix and something like that.
You can change it through preload scripts. This is how I worked to intercept the addeventlistener function and inject it into it and into the functions that are set to logger events, and also struggled with the fingerprint. There would be a desire.
The user agent already arrives at the server each time along with the request-a object.
Poke: Node.js.
you receive a request from the client > check what you are interested in in ua > rendering the corresponding page and sending the page to the client.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question