Today I came across an issue with Lightbox (the javascript image gallery) and after ages of trying to find out what it was everyone seemed to be saying the problem was in the JavaScript and how it was called.
The thing that made me think otherwise was the exact same website was working perfectly on another server which was Linux. After looking around the code I noticed the lightbox file was called lightbox++.js
Every time you clicked on an image in the gallery I got the Error: Lightbox is 'undefined' and in FireFox - 'Lightbox is not defined.
On a hunch i tried entering the path in the lightbox.js file into the address bar and IIS said the file didn't exist! I then had a lightbulb moment.
IIS doesn’t seem to like the + character in the lightbox++.js file name and wouldn’t serve up the file so I renamed to lightbox.js and updated the reference in the calling page and bingo! It works fine.
So if you get the Error: Lightbox is 'undefined' message and are using a Windows server and IIS then don't use + in the file name!
The thing that made me think otherwise was the exact same website was working perfectly on another server which was Linux. After looking around the code I noticed the lightbox file was called lightbox++.js
Every time you clicked on an image in the gallery I got the Error: Lightbox is 'undefined' and in FireFox - 'Lightbox is not defined.
On a hunch i tried entering the path in the lightbox.js file into the address bar and IIS said the file didn't exist! I then had a lightbulb moment.
IIS doesn’t seem to like the + character in the lightbox++.js file name and wouldn’t serve up the file so I renamed to lightbox.js and updated the reference in the calling page and bingo! It works fine.
So if you get the Error: Lightbox is 'undefined' message and are using a Windows server and IIS then don't use + in the file name!