Expand my Community achievements bar.

\/etc/clientlibs/granite/jquery/granite/csrf/source/csrf.js Prevents Loading of Google's ReCaptcha Script in IE 11 and Edge

Avatar

Level 2

Hello there,

I've pin-pointed the file and line that's causing the error, but am unsure of how to solve it. The culprit file is located at /etc/clientlibs/granite/jquery/granite/csrf/source/csrf.js which is in the granite.jquery clientlib. The relevant code block is the following:

if (result.nodeName === 'IFRAME') {if (result.contentWindow && !result._csrf) { result._csrf = true; handleForm(result.contentWindow.document); } }

The error doesn't occur in other browsers because result.contentWindow.document is a valid populated object by the time it's passed in to handleForm.

Meanwhile, in internet explorer, result.contentWindow has a predominant error object within it, preventing the document from being properly populated. Before the handleForm function has a chance to run, an exception is thrown and execution is halted, preventing the remaining google code from running and the granite handleForm function from running.

Does anyone know how what I can do about this? I'm at a loss.

3 Replies

Avatar

Level 10

This looks like a bug - please file a ticket so Support and ENg teams are made aware of this: https://helpx.adobe.com/marketing-cloud/contact-support.html

Avatar

Level 1

Hi Tigran,

 

I'm facing the same issue for the integration of google recaptcha. Did you find a solution? Or filed a ticket at day care? 

Avatar

Level 2

Hi Christopher, yes, we got a response from day care. The rep said that it was a known issue and would be fixed in 6.2 and provided a workaround for 6.1:

Within csrf.js replace the following:

if (result.contentWindow && !result._csrf) { result._csrf = true; handleForm(result.contentWindow.document); }

with:

try { if (result.contentWindow && !result._csrf) { result._csrf = true; handleForm(result.contentWindow.document); } } catch (ex) { if (result.src && result.src.length && verifySameOrigin(result.src)) { if (window.console) { console.error('Unable to attach CSRF token an iframe element on the same origin'); } } // Potential error: Access is Denied // we can safely ignore CORS security errors here // because we do not want to expose the csrf anyways to another domain }