-
Notifications
You must be signed in to change notification settings - Fork 967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Injecting Javascript before page loads #138
Comments
Yep, take a look at https://github.com/nfriedly/node-unblocker/blob/websockets/lib/client-scripts.js I had to add that to catch websocket connections and force them to go through the proxy, and I have todo's for XMLHTTPRequest and fetch. Everything in this section gets wrapped in an IIFE and injected right after the node-unblocker/lib/client-scripts.js Lines 15 to 45 in 7c44200
Note that websockets always require a complete url (including the domain), which would bypass the proxy without this, but XMLHttpRequest and fetch allow for relative URLs which would go to the proxy and just work (sometimes). |
Is it possible to add scripts as a configuration option? Would I put the function I want to inject into the response middleware as a string or something? |
Yeah, that's fine. I'll probably make some changes to it, but not tonight.
…On Wed, Apr 15, 2020, 5:09 PM Noah Gerard ***@***.***> wrote:
Interesting. Would you mind if I made a PR request for adding scripts to
this list through the code?
Maybe something that could be added as a configuration option?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#138 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA4CIBHASLIQAZUUPB2OU3RMYO7HANCNFSM4MIFA62A>
.
|
How would I inject this javascript:
alert('INJECTED')
into a website being served? Also, can I intercept AJAX/Http requests from the website through the proxy?Injecting Javascript using response middleware will inject the script for ALL the sites proxied through, right?
The text was updated successfully, but these errors were encountered: