Hmm, maybe -- better get the latest from the demo: http://codepen.io/figureone/pen/GWZmGo/?editors=0010
Works fine in all browsers now - even Edge! Thanks Sandy.
There's another bug we discovered as we were using older versions of IE that does not process "IndexOf" properly, to fix this I added this if statement before the function and this fixed the issue.
<script>
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
(function(redirectTarget){
var allowedOrigins = [
'http://example.com' .......
Oh you were testing in IE 8? I don't build for IE 8 compat in a Marketo environment as core Mkto features don't work in IE 8, anyway.
Array#indexOf is in IE 9 and later.
Yes, unfortunatly our IT dept are slow to update browsers, the same applies to alomst all big companies out there, I know our clients still use older browsers. So for those out there still using older browsers, adding that fix for IndexOf will make this solution work for them. Either case thank you for your overall solution! and for anyone who is not following your blog.. IT IS A MUST READ for anyone in the Marketo world!
Yeah, I know IE8 is out there (though in finserv IT should be looking at it from from a security perspective, difficult or not!).
Just make sure you guys don't expect other Mkto things to work in IE8, like secure LPs and forms (the former being a valuable tracking tool, not just a security measure). And all my code is written for IE9+.
Genius solution Sanford Whiteman, love your work... AGAIN!
Thank you