I’ve been pulling my hair out trying to solve this problem. We support IE8 and use a company called “Marketo” for some analytics. When I load their Javascript file as an external, then try to instantiate the class within the file, it throws a Javascript “Object expected” error in IE8. It does not cause this in Firefox or Safari.
However, when I manually paste the contents of the external inside a <script> tag, the class instantiates fine! It’s only when the Javascript file is external that the problem is caused. I must use an external because Marketo updates their code regularly and I can’t keep on top of the copying/pasting.
Here is the external: http://munchkin.marketo.net/munchkin.js
Here is how I load the file:
<script type="text/javascript" src="http://munchkin.marketo.net/munchkin.js"></script>
Here is how I instantiate the class:
<script type="text/javascript">
mktoMunchkin("300-EOJ-215");
</script>
Using setTimeout() doesn’t help anything (I thought maybe it was a slow server causing a timing issue):
<script type="text/javascript">
setTimeout(function() {
mktoMunchkin("300-EOJ-215");
}, 5000);
</script>
Any ideas?
UPDATE: Figured out what the problem was. We were delivering our webpage over HTTPS and pulling the Marketo munchkin.js file over HTTP, which for whatever reason IE8 (and not Firefox, Safari, etc.) had a problem with. Switched the URL to https://munchkin.marketo.net/munchkin.js and it was fine.
Figured out what the problem was. We were delivering our webpage over HTTPS and pulling the Marketo munchkin.js file over HTTP, which for whatever reason IE8 (and not Firefox, Safari, etc.) had a problem with. Switched the URL to https://munchkin.marketo.net/munchkin.js and it was fine.