Showing results for 
Search instead for 
Did you mean: 

google recaptcha cross-origin error after form submission

google recaptcha cross-origin error after form submission

I have built a module displaying some content and have put a newsletter signup form at the bottom protected by google recaptcha.  The first time a person visits the page the recaptcha loads and the user can check the "i am not a robot" box to submit the form.  However once a person submits the form the page loads and the reacptcha is removed from the page with a cross-origin error in the browser debug console. Magento ver. 2.4.3-p2



Uncaught DOMException: Blocked a frame with origin "" from accessing a cross-origin frame.
at Y.Ip (
at Array.<anonymous> (
at Object.init (


To add to the confusion it is only happening on this page, and only on the production instance of the application. other identical instances (staging, dev, localhost sandbox) all work without error after submitting the form.  There are other pages on the site that have the same newsletter signup form and they all work fine. it is just this one (module)page on this one server instance.  what could the problem be?


not working: (submit the form once and it will never load captcha again; will load briefly then get immediately removed with cross-origin error)




Re: google recaptcha cross-origin error after form submission

Hi @qodeqrashgde80 ,


On customer stories page I can see below error in console.

Uncaught Error: reCAPTCHA has already been rendered in this element


So, seems like it happens because of same thing calling multiple times.

Other pages I can't see same error.


Please check code for re-captcha that you are using on customer stories page and avoid re-calling or re-initialization for the same.


Problem Solved? Accept as Solution!


Hope it helps!


Ankit Jasani



Re: google recaptcha cross-origin error after form submission

The problem is not solved. I had to use a workaround (reinitialize the recaptcha a second or so after dom ready).  A strange thing about the problem is that you have to submit the form once, then it will never load on the page again.  You can do this many times with new incognito windows.


this only happens in this environment and no other identical environments. it is very strange.