This is a bit of a recap from a couple posts I had last week, but there is a work around I found for dealing with an annoying problem in IE 7. I just wanted to post the issue and workaround here in case anyone else was having XML issues in IE 7.
The questions I posted last week dealt with XML and localConnection (many thanks to duncanhall and sarahelizabeth for directing to me localConnection.) Basically I had 2 swfs on a page. The main swf has the ability to modify some XML data (via an ASP script and database.) The second swf includes content populated by some of that XML data. When the data is modified, the first swf sends a call to the second (via localConnection) to refresh that data. I had everything working perfectly Saturday afternoon until I tested it in IE7 (on Win XP Home.) Older versions of IE, Firefox and Safari all showed no problems, but when the data should have been modified nothing seemed to happen. Nothing updated, etc.
I was able to confirm in the database that the update was actually happening, just not appearing. At first I thought IE7 wasn’t playing nice with localConnection, but I eventually determined that IE7 wasn’t playing nice with XML since it would happen in swfs that didn’t use localConnection at all. localConnection was running and acting as it should, but IE7 was caching the XML feed even though the only component ever making a call to the XML was the swf. The XML was getting cached in IE and IE wouldn’t let go (the only way to see updated data was closing and reopening the browser, or going into 7’s new browsing history to delete the cache.)
The work-around I used was to add a querystring variable to URL for the XML feed. Every time the swf looks for it, it uses getTime to add a number of milliseconds to the end of the string so IE thinks it’s getting a new file:
currentDate = new Date();
currentTime = currentDate.getTime();
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("[http://whatever.com/feed.xml?](http://whatever.com/feed.xml)" + currentTime);
It’s not the most elegant solution, but I’ve been testing it on and off since Saturday evening and it seems to work without issue.