I came across a rather interesting bug today while working on nFront Security’s new website (it’s going to be bad ass by the way.)
We want to track downloads, obviously, to see who is really interested and who isn’t. In other words, who we want to spend time and money on pursuing based on the fact that they download. Enough, business talk. To do this, I just created an AJAX call every time someone clicked on a download link. The php script is passed the versionID and tracks the logged in user’s unique ID along with the time.
Here is where the bug comes into play. Originally I just had the link as a standard <a href="fileSource" onClick="updateDownloads()">. Firefox doesn’t seem to like this very much. Here is the error I get on the javascript console.

It seems that while the AJAX request is occuring (to update the downloads table), it is trying to request this file to download. Mind you, in IE, this works perfectly. The logic would have to be the IE implmenents some sort of queuing, while Firefox has a bug somewhere regarding this.
The solution was to call the download AFTER the AJAX call is complete. I use Prototype, so that’s no big deal. Just call
location.href = downloadLink
I hope that I help at least one person with this problem. It seems like this would be something that would be done regularly, but I guess not since I couldn’t find a single forum topic, blog post, or anything regarding it.
Oh yeah..HAPPY HOLIDAYS (belated of course)
Sphere: Related Content








