After changing domain name where flash application being hosted I should change crossdomain.xml file. That crossdomain.xml is hosted on api-server, which is used by flash application. I see that flash uses crossdomain.xml from browser's cache. Is there any trick to make flash to not get crossdomain.xml from cache? Maybe there is any parameter, that I can pass to flash during it's call in object tag?
Annoying issue - no doubt.
First of all: I like Caching - as long as I'm in control. This is, how I gain control over crossdomain.xml caching:
Let's say, we have a flash app that requires some input from a different server.
In my case we have this configured as a flashvar dataSrc=http://www.company.com/data/calendar.xml
So flash is looking for
www.company.com/crossdomain.xml
... which is loaded once and than taken from users browser cache until he manually flushes it.
The solution is in changing the subdomain the crossdomain.xml ist taken from:
Make sure, that for example(!) noCache.company.com/ points to company.com's documentRoot.
Flashvar is modified to dataSrc=http://noCache.company.com/data/calendar.xml
. In fact, you're addressing the same file as before.
Flash is looking for noCache.company.com/crossdomain.xml
which will be taken from the Server now because there is no cached file for that uri.
It's up to your fantasy... if you allow subdomains like noCache_{numeric_value}, you could easily handle your own TTL by accessing http://noCache_{week_of_year}.company.com/data/calendar.xml ...
You can as well increment that numeric value each time crossdomain.xml has changed.
Use following apache directives to specify caching policy for the file:
<Directory /var/www/mysite>
<FilesMatch "crossdomain.xml">
Header set Cache-Control "max-age=86400, public, must-revalidate"
</FilesMatch>
</Directory>
I append random numbers to the end of xml files if I don't want them to cache eg. var myXMLURL:String = "myXML.xml?r=" + Math.random()*1000;
The browser sees it as a different file eg. myXML.xml?r=645 / myXML.xml?r=239
I'm not sure if this would work with crossdomain.xml files, but it should be worth a quick try.
crossdomain.xml
is called by internal mechanisms of Flash. If you know how to influence on this request, and add to it parameters, please share. –
Mineralogy I would forced reload (F5 or CTRL/CMD-F5) the crossdomain.xml file directly in the browser until I see it changes. Just type in the crossdomain file's URL in the browser and keep on refreshing. Also I would clean the browser cache.
You should try Firefox and firebug which shows you whether the downloaded files are cached or not.
Good luck, Rob
© 2022 - 2024 — McMap. All rights reserved.