PDA

View Full Version : MediaPanel caching my swf!



SpectralForz
21 Apr 2010, 7:27 AM
I have a MediaPanel displaying a swf. I have a form that alters the file that the swf reads. The problem is, IE caches the swf file and doesn't update the swf when I make changes to the form. Chrome and Firefox both don't cache the file. But my customer ... ".mil" can't use Chrome or Firefox.

Here's the code sample. As you see, I have disableCaching = true and I've changed the URL of the swf to include a timestamp. I've even tried to sell having users set "Check for newer versions of stored pages" set to "every time". That didn't fly.

function getChart() {
var ts = new Date();
var se = ts.getMilliseconds();
var swfUrl = '/approot/index.swf';
swfUrl += '?time=' + se;

var tmpPanel = new Ext.ux.MediaPanel({

title:'Chart',
closable:true,
dockOnly:true,
id:'flexPanel',
text:'loading...',
disableCaching: true,
mediaCfg: {
mediaType: 'SWF',
url: swfUrl
}
});

tmpPanel.renderMedia();
Ext.getCmp('centerPanel').add(tmpPanel);
Ext.getCmp('centerPanel').setActiveTab(tmpPanel.getId());

}

I'd appreciate any insight or suggestions of new things to try.

CrazyEnigma
21 Apr 2010, 10:22 AM
IE is such a pain, and I feel for you, but I think I offer no other advice than the one you already tried, so I feel for you.

Seeing as you are using M$ technology, have you tried creating a web service, that just sends a content-type "swf" stream.

SpectralForz
22 Apr 2010, 4:54 AM
Thanks for the sympathy Crazy. IE is indeed a pain.

Does anyone have some anti-caching strategies that might be applicable?

SpectralForz
23 Apr 2010, 1:16 PM
It turns out that IE was caching the file as well as the SWF. When I added a "math" to the file inside the SWF the caching stopped. So for IE always append a timestamp to your files to prevent caching.