Facebox and IE7: Stack Trace Overflow
In our latest release of City Cliq, we became more and more dependent on Facebox for previewing and editing Cliq Sites. As we continued development, and with subsequent browser testing, we noticed that IE7 was giving us a “Stack Trace Overflow” error, while Safari and Firefox were handling all of our code gracefully [as always].
Unfortunately for me, I was given the task of resolving this issue. I have been tackling browser compatibility issues for more than a decade, so the delegation was an easy one. I am happy to say that I resolved the issue with the same ease, though it took a bit of digging.
I finally found some relevant information on the Facebox web site, where it is advised to load all of your dependencies before you make any Facebox calls. We have several scripts that run in our edit and preview screens and it wasn’t until I read the dependency issue that I decided to start pulling out and rearranging script calls to isolate the ‘Stack Trace Overflow’ problem in IE7.
As it turns out, we were loading our application.js file after we loaded our facebox.js file. For those of you who keep up with Javascript and specific browser implementation of Javascript, you will know that IE7 uses a more propriety version of Javascript in it’s browsers called JScript. Big surprise there, eh? This is why Firefox and Safari were not having any problems with the Stack Trace: IE couldn’t handle the requests being slightly out of order (they are all there at run time, IE, quit being a baby) hence the IE only error.
Cliff Notes: IE will take a big dump at run time if you attempt to run any scripts that references the Facebox.js file. Just to be safe, render all of your JS files, and render your Facebox.js file LAST.
I could really use a Rum Drink right about now.