SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to stop IE from caching a file?

    I'm not sure if this is a PHP question, sorry if it's not. I have a website where there is a flash mp3 player that loads an xspf playlist. Users can submit links to add to the xspf file, but when the page is refreshed in IE it appears it's using the cached xspf file because the new song doesn't appear. I dont have this problem in firefox or safari. Is there any way I can prevent it from loading the cached version of the file?

    Maybe there is something I can do with php so that the xspf link (a parameter for the swf) is a little different everytime but still points to the same file on my server (using a .htaccess redirect)... Any ideas?

    Thanks in advance!

  2. #2
    SitePoint Evangelist hexburner's Avatar
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had problems with this one too, especially with IE6.
    You can add a querystring to the end of the url of the xspf file. For example, a timestamp. Or you can add an Expires header telling IE that it expires immediately, but I've noticed you still have to touch() the file.

    I've been looking for a better solution for this one, so if anyone knows how... ?
    FOR SALE: 1 set of morals, never used, will sell cheap

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2007
    Location
    Bristol, England
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can tell IE to not cache the file, header(). Also, if you are refreshing the same page dynamically, it is best to pass a unique query string value. IE tends to choke with regards to that.

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, as far as the thing I can do with the header, such as make it not cache files or have it expire immediately, can I have it just do that to that specific file, or would that prevent all caching (which I don't want)? Sounds like the best way would be the unique query string thing.

  5. #5
    Worship the Krome kromey's Avatar
    Join Date
    Sep 2006
    Location
    Fairbanks, AK
    Posts
    1,621
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just put it in the file that's generating your xspf playlist - it will only affect that one file. (This is, of course, all assuming that a PHP script is generating your xspf file.)
    PHP questions? RTFM
    MySQL questions? RTFM


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •