I am having a problem with an HTML form to which I just cannot find a working solution, hence this post. All I want to know is if this is possible in any way or not?
Situation: I am trying to send an HTML form to an URL from a different domain. When submitting the form, I should not get redirected. I apparently cannot use Javascript (according to the accepted answer in this post), as this would trigger a CORS Request which I cannot use because of the same-origin policy.
and there is no javascript involved in posting the form, then the same origin policy is not applicable.
Things I've tried:
- Submitting via Javascript
- Setting the target to either
blank
or to an invisible iframe - Searched through Google and StackOverflow.
The code below works fine, it just redirects me to someotherdomain.com
, which I don't want. I want to stay on the current page.
<form method="post" action="someotherdomain.com">
// all the input fields
<input type="submit" value="submit">
</form>
Is this possible in any way or not? Could I solve it in a way that I haven't considered yet?
EDIT: I cannot enable cross-origin requests.