It’s a new year and apparently that means it’s time to get back and spend some more time working on MS Project Add-ins. The previous one was incredibly useful and I needed to make a couple of modifications so I could re-use the same approach for a new project. The new version needed to hit a different endpoint (no VersionOne this time, yay!), but otherwise needed to get similar data and do similar stuff.
I thought it was going to be incredibly simple (and it was in the end), but I ended up getting caught by an odd piece of stupidity.
Back when I did my other Add-in I’d grabbed a quick downloadable sample from Microsoft and used that as my starting point, and I’d used that Add-in as the starting point for this new one. Both of the HTML files contained the following tag:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
For some reason this hadn’t been a problem with any of the $.ajax calls in the previous Add in, but here, it was killing $.ajax’s attempt to use CORS. My guess is that the slightly different approach I had to take for authing to the new endpoint was pushing things over the edge, as otherwise the $.ajax requests between the two Add-ins were pretty identical. IE10+ got better/proper support for CORS which jQuery is well aware of and checks for before performing any $.ajax requests, and so the instance of IE11 running inside MS Project pretending to be IE9 was probably confusing the hell out of jQuery.
All I had to do was update my tag to get things working:
<meta http-equiv="X-UA-Compatible" content="IE=Edge" >
A really obvious fix, but when you’re doing web development inside MS Project with limited debugging (*cough* NO ALERT *cough*) it’s amazing how easy it is to overlook the simplest fixes.