We're using BBC's Imager Library on a web project. When we declare the Imager in our scripts file, we see an error in IE8:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022) Timestamp: Tue, 2 Jun 2015 09:22:12 UTC
Message: Object expected Line: 2 Char: 1 Code: 0 URI: http://domain.dev/js/scripts.1433236916.js
Line 2, char 1 is the 'v' of 'var' in this line of code:
var Imager = new Imager({ availableWidths: [200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000] });
Our JS includes are:
<script type="text/javascript" src="/js/Imager.1432903035.js"></script>
<script type="text/javascript" src="/js/scripts.1433236916.js"></script>
We have no errors in modern non-IE browsers (Chrome/FF)
How can I resolve this error in IE8?
The problem is the var name being the same as the library object name. Solution is: