I have a simple HTML form:
<form action="https://something.com" method="POST">
<input type="hidden" id="test" value="test">
<input type="submit" value="Send">
</form>
I want to write (if it's possible) a javascript that will
- be executed when a user presses "Send" button
- add a customer header to the request (before it's send)
A couple of notes:
- I know that I can do this thing in JavaScript () and manipulating a request in it will be trivial. However, for my purposes, the form should be in HTML
- I know that I can return a header from the backend and it will be send back by the browser. However, again for my purposes, I can't return it by the backend.
So, the goal is to capture the request when it will be made and modify it.
Is this possible?