Nevermind. I was able to find that I can use <span> tags to style accordingly.
Hi Sanford Whiteman - when I change the url in the codepen example to a PDF it doesn't load, it opens a new tab with the PDF url but there is just a white screen. This is only in Chrome. Seems to work fine in FF. Any ideas?
MktoForms2.loadForm("//app-sj01.marketo.com", "410-XOR-673", 333);
MktoForms2.whenReady(function(form) {
var formEl = form.getFormElem()[0],
thankYouWindow;
form.onSubmit(function(form) {
thankYouWindow = window.open('');
});
form.onSuccess(function(vals, thankYouURL) {
thankYouWindow.document.location = 'https://info.tmforum.org/rs/021-WLD-815/images/dtw-2019-event-brochure.pdf';
formEl.innerHTML = 'Thank you! Your asset has opened or downloaded in a new window.';
return false;
});
});
Have you turned off the Chrome viewer or have some other plugin interfering? The easy test is to open a new tab manually and put that PDF URL in the location bar. The behavior should be exactly the same as when the form opens the tab.
Thanks Sanford. I've checked and:
'Download PDF files instead of automatically opening them in Chrome' is Off
The PDF loads if I manually put it into a new tab
PDF doesn't load if I refresh the page the JS opened
Although the issue only seems to be occurring in CodePen on Chrome - running Version 73.0.3683.75 (Official Build) (64-bit). It does work if I add it to a Marketo LP, which I guess is good enough for me. But strange it's not working in CodePen.
Are you running it from the debug CodePen (change /run/ in the UTL to /debug/)?
See video of CodePen demo on Chrome 73 x64/Windows 10: CrossBrowserTesting Video Recording
Thanks for the tips, Sanford. But still doesn't seem to be working, but I'm guessing it must be something local to my machine: Video recording
How could it be local to your machine if it's happening on CodePen using the CBT lab?
I thought maybe one of my browser settings? Do you think it's a CodePen setting?
Test the "debug" mode on CodePen, not "full": https://codepen.io/jwright_tmf/debug/oVPVWE