简体   繁体   中英

Cross domain form submission via iframe, without server side controls

I'm attempting to set up a same-page form submission mechanism for a client website. Their forms submit to a handler page which is on a different domain, so I cannot submit via ajax. Previously I have had success cloning my form into an iframe and submitting that (I don't need to retain control of the iframe, and I don't need to verify receipt, just post the data) but that is now being blocked in Chrome.

It would be relatively trivial to add cross-domain headers if I had control of the servers involved, but I don't.

Is there any way to resolve this, or do I have to tell my client that the method I was using is no longer available and they have no options without making server-side changes?

There's no need to clone the form. Just set target="iframe_name" on the <form> element.

Just target the iframe. You can change form's target and action dynamically, if for example you need to reuse it for some other submission.

<form target="IFRAME_NAME">...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM