Saima
Saima

Reputation:

Latest version of XML not loaded in Firefox though works OK in IE

I am using AS2. I load an XML file in my movie. Somehow, the XML file is loaded. Now. if I change the XML file, the latest XML file do not appear in FireFox while lates XML file appears in IE. Can anybody tell what is the problem

Upvotes: 1

Views: 809

Answers (2)

Oliver Turner
Oliver Turner

Reputation: 1392

Taking it further, you'll want to make sure that this situation doesn't arise in the future - i.e. after you've cleared your cache this time...

There are several methods:

  1. Using a "cache-buster" string appended to the location of the file - e.g.
    ./data.xml?nocache=010920091407
    where you use the Date object to dynamically generate the value of nocache. This is OK, but means that the XML will never be cached, since every time the flash is loaded the nocache value will change.
  2. Dynamically generating the XML contents - i.e. calling
    ./data.php
    Same issue as the above: the content is never cached but loaded afresh every page view
  3. Better: "Autoversioning"
    1. use PHP alter the path to the file such that
      ./data.xml
      becomes
      ./data.010920091407.xml
      where 010920091407 is the filemtime value of the file (i.e. when it was last updated)
    2. pass this value in to your flash app via flashvars when embedding it.
    3. Use a mod_rewrite rule (e.g. in a .htaccess file) to translate the path for files with this naming convention:
      RewriteRule ^(.+)\.(.+[0-9])\.(js|css|swf|xml)$ $1.$3
      strips out the
      .010920091407
      and returns the file at
      ./data.xml
      but the browser thinks it's loading a new file. Now you can guarantee that users will load a new version of the file every time it does change, but from cache if it hasn't. (You'll see that here I've told it to do this to any of the files I typically need to be guaranteed of an update: *.js, *.css and *.swf as well)
    (Obviously this is assuming a LAMP server, but the principle is the same under any stack)

Update: a useful tutorial can be found here:
http://particletree.com/notebook/automatically-version-your-css-and-javascript-files/
A more in-depth one is here:
http://www.ejeliot.com/blog/125

Upvotes: 0

Luke
Luke

Reputation: 21236

Clear your cache?

Upvotes: 1

Related Questions