Today I had faced a near disaster. We were to deliver an offline HTML/CSS/JS based web application which was planned for distribution in a major Arab-African event using USB drives. The application itself was pretty straight forward, we had to export and stage data, implement a JSON provider, convert those exported data to JSON and use it inside our application using AJAX calls. Even though the project was small, we had a commitment and a very rigid deadline. There was another company who were waiting for us to provide the files for them to prepare and deliver the USB for the event. I had a junior colleague working with me. For the sake of visibility, we placed the development version of the application in his local apache server and also on our demo server. The project ended very quickly with almost no hiccups. Not even the smallest ones! I was very happy to see it progressing rapidly. But, at the same time I had something in my head telling me something is wrong. The project was too small for me to get worried. We tested the application in different browsers for compatibility and then delivered on schedule. The client was more than happy.
Three days after, the company who were responsible for the USB came back to us with some questions. I was not in the office, so my project manager downloaded the contents which we had sent them earlier and KABOOM! It was not working! Well, it was working with Firefox, but not with Chrome or Internet Explorer. By this time, they must have prepared the USB cards and shipped them to our client! We were at loss!
The problem was in making AJAX calls to local JSON. Both Chrome and Internet Explorer were treating the AJAX calls to the local JSON files as cross-domain calls and it was failing. I quickly got panicked and could not think of a way to make the AJAX calls domain safe without taking the whole thing apart. This glitch got overlooked since were were testing the whole thing from a local apache server and the JSON file was on the same domain (localhost) as the HTML file. I did check the files directly from the file system, but using only Firefox (which was my default browser) and things worked flawlessly. It never occurred to me to check the files from the file system using different browsers since we had them tested in different browsers earlier from our apache servers, both development and demo!
The thing is, I was not comfortable while delivering the contents the first time but I did not care to recheck the files thoroughly and systematically. When you’re working in the industry for some time, you actually grow a sixth sense which tells you if something is about to go wrong. Do not ignore these feelings, make sure you’re absolutely confident while delivering. If you feel something might be wrong, chances are high that something is wrong! Trust your instinct, it never hurts to invest an extra hour double checking if everything is behaving as they should.