I am attempting to utilize the Google reCAPTCHA in a CONFIRM message box. It works perfectly when the confirm box is run ‘onload’ but when launched using a function, it fails to load.
Here is a snippet showing what is happening (click ‘CANCEL’ for the onload version - the one that works - and then click ‘SHOW CONFIRM’ to show the one that does not work). NOTE: same code in both cases except for function.
Even though the CAPTCHA now shows in the dhxWindow, I am now getting a ‘cross-origin’ error (Uncaught DOMException: Blocked a frame with origin “https://www.google.com” from accessing a cross-origin frame at window_blur). As I read about this error, it appears that the way the dhxWindow is being rendered conflicts with this security protocol which restricts how a document or script loaded by one origin can interact with a resource from another origin. What is the work-around for this (without compromising the security)? Thank you.
Hello. And, thank you. I had reviewed this same Stack Overflow page prior to my previous question. The accepted answer (and popular with 1110 upvotes) deals with an i-frame with an origin from a DIFFERENT PAGE which is not relevant here given the dhxWindow opens on the SAME page. While window.open() is suggested for an i-frame on the SAME page, the reference page specifically states this method is not recommended due to pop-up blockers etc.
If the dhxWindow is opened on the same page and I have no control over the ID issued (const frame = document.getElementById(‘your-frame-id’)) for the i-frame (see screenshot), I am not seeing how to overcome this cross-origin error. I would appreciate any suggestions/input. Thank you.