SOLVED

Re: MktoForms2 is not defined in Marketo Forms 2 Cross Domain request proxy frame script.

Go to solution
Mike_Rojas
Level 2

Embedded forms not submitting in FireFox Private mode.  We are using a CNAME to load the form but it looks like there is an additional script on the Marketo side that is loaded with a Marketo CNAMe and not our custom CNAME.  Is this something we can control?

Screen Shot 2019-10-08 at 8.59.46 AM.pngScreen Shot 2019-10-08 at 9.02.01 AM.png

The script is loaded with our CNAME though it's loading the forms.js from the Marketo domain.  Can this be updated to use our CNAMe as well?  

Is there another way around this issue?

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

Ugh, I though this had been fixed permanently before. Guess we have to use my workaround still.

Upload this file to your Design Studio assets:

   Marketo Forms 2 Cross Domain request proxy frame 

Refer to that file in your options before loading the form:

<script src="//p.highspot.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_2998"></form>
<script>
MktoForms2.setOptions({
formXDPath:"/rs/623-OHN-043/images/marketo-xdframe-relative.html"
});
MktoForms2.loadForm("//p.highspot.com", "623-OHN-043", 2998);
</script>

Demo:

   MktoForms2 :: XDFrame relative path for Tracking Protection

View solution in original post

16 REPLIES 16
SanfordWhiteman
Level 10 - Community Moderator

Please point to the the page you're using to test. text/html isn't a mismatch for the HTML content.

Michael_DeRosa
Level 2
SanfordWhiteman
Level 10 - Community Moderator

And looking at your .html file I see you must've saved it with your browser's Save-As, since it mangled the content (that whole .download path is certainly not in the original file). Use the exact HTML file I provided.

SanfordWhiteman
Level 10 - Community Moderator

I mean the page with the form.

Michael_DeRosa
Level 2

Unfortunately I don't have access to remove the basic authentication on the test page at the moment. I'll get it temporarily removed when I can, likely early tomorrow.

SanfordWhiteman
Level 10 - Community Moderator

Like I said in my 2nd response above, the problem is you saved the HTML file using some outside process, which altered the contents. You want the exact file I provided, no changes.

Michael_DeRosa
Level 2

Thanks for your quick and informative replies Sanford. You are right. I uploaded the your orig html and the work-around seems good. 

SanfordWhiteman
Level 10 - Community Moderator

OK, cool, glad it works as expected!

Mike_Rojas
Level 2
SanfordWhiteman
Level 10 - Community Moderator

Ugh, I though this had been fixed permanently before. Guess we have to use my workaround still.

Upload this file to your Design Studio assets:

   Marketo Forms 2 Cross Domain request proxy frame 

Refer to that file in your options before loading the form:

<script src="//p.highspot.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_2998"></form>
<script>
MktoForms2.setOptions({
formXDPath:"/rs/623-OHN-043/images/marketo-xdframe-relative.html"
});
MktoForms2.loadForm("//p.highspot.com", "623-OHN-043", 2998);
</script>

Demo:

   MktoForms2 :: XDFrame relative path for Tracking Protection

Michael_Sogunro
Level 2

Hi Sanford,

I cannot get this to work. Can you take a look if you have a moment?

<script src="//page.uschamber.com/js/forms2/js/forms2.min.js">
</script>
<form id="mktoForm_2325"></form>
<script>
MktoForms2.setOptions({
formXDPath:"/rs/432-UWH-935/images/marketo-xdframe-relative.html"
});
MktoForms2.loadForm("//page.uschamber.com", "432-UWH-935", 2325);
</script>

SanfordWhiteman
Level 10 - Community Moderator

This is wrapped up in a blog post now, pls check there for details: https://nation.marketo.com/community/product_and_support/blog/2019/11/12/really-finally-winning-the-...

Michael_DeRosa
Level 2

Hi Sanford, 

We've tried to apply the suggested fix, but are now getting the following errors: 

The resource from “//go.mydomain.com/rs/[marketo code]/images/marketo-xdframe-relative_files/forms2.min.js.download” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).marketo-xdframe-relative.html

So, since forms2.min.js.download is blocked, the proxy page throws this error: 

Uncaught ReferenceError: MktoForms2 is not defined
at marketo-xdframe-relative.html:8
at marketo-xdframe-relative.html:46

Unfortunately we don't have access to the server to modify the "X-Content-Type-Options" setting immediately, and I'm not sure we'd want to remove the nosniff anyway. Is there a work-around for this? 

Mike_Rojas
Level 2

We have deployed this and forms are working in Private mode now. Thank you! 

SanfordWhiteman
Level 10 - Community Moderator

Great, I'll add this to the Products blog soon.

SanfordWhiteman
Level 10 - Community Moderator

Pls provide the URL of this page.

Also, terminology FYI: the CNAME of your LP Domain/Domain Alias is <accountstring>.mktoweb.com. The LP Domain is an *alias*. 

In other words, the CNAME is the right-hand-side of a CNAME DNS record, not the left.