Hi all,
Our marketo embedded form is throwing a
CORS error and will not submit
Thanks,
Solved! Go to Solution.
OK, figured it out.
The problem is you have a race condition between your 2 forms, which are loading from different domains. When the cross-domain IFRAME shim (which is designed to avoid the need for CORS) loads from one domain and tries to post to the other domain, you then need a CORS request, which in turn fails because the server is not set up to respond to OPTIONS requests (it should never receive a CORS request).
This set of conditions will occur randomly, based on network connection speed + quality and cache conditions, since the form descriptors load asynchronously.
Load both forms from the same domain and the problem will go away:
MktoForms2.loadForm("//go.portworx.com", ...
No possible way to troubleshoot anything like this without a URL.
There appears to be two forms on this page looking at the source code: id 1181 and id 1061. Do they exist and are approved in your instance?
I can't replicate this in FF or Chrome (nor would I expect to). What browser + OS + version are you testing this in?
Also that that it wouldn't truly be a CORS error, anyway -- preflight OPTIONS is itself triggered by CORS, but the error is not related to cross-origin communication. It's like getting a 404 for a preflight -- that's not a CORS-level rejection, it's just noticed first by CORS.
i think i was able to receive your form.
how did you do that?
Just... filled it out. I didn't receive any errors from either of the 2 forms.
What browser/version/OS are you using, specifically?
Hi Sanford,
and this is the error on inspector
OK, figured it out.
The problem is you have a race condition between your 2 forms, which are loading from different domains. When the cross-domain IFRAME shim (which is designed to avoid the need for CORS) loads from one domain and tries to post to the other domain, you then need a CORS request, which in turn fails because the server is not set up to respond to OPTIONS requests (it should never receive a CORS request).
This set of conditions will occur randomly, based on network connection speed + quality and cache conditions, since the form descriptors load asynchronously.
Load both forms from the same domain and the problem will go away:
MktoForms2.loadForm("//go.portworx.com", ...