A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: How to invalidate browser cache?

  1. #1
    RSS addict
    Join Date
    Oct 2005
    Location
    London
    Posts
    5

    How to invalidate browser cache?

    Hello,

    I am building and testing a website on a local PC. Current stage of the implementation mainly involves designing flash components. I have discovered that Firefox and IE (the browsers I use for testing) cache the swf's, making it impossible to view any design changes in the browser window.

    I would like to know if there is a way to prevent Windows from caching "swiff" files?


    Any suggestions are welcome,
    Thanks in advance...

    Arnie

  2. #2
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    I think deleting the cookies and internet files should work. Just click on internet options and delete them.

    I know what you mean about having the problem , it does get annoying. I have a default.aspx file in my ftp, so to get rid of cache problems I just add a different number to the file and it gets rid of it

  3. #3
    RSS addict
    Join Date
    Oct 2005
    Location
    London
    Posts
    5
    Unfortunately, deleting all swf's in Temporary Internat Files folder doesn't solve the problem, the browser manages to find the old file somehow (how - I do not know) and doesn't download the new one.

    Disabling caching in both browsers didn't solve the problem either...

  4. #4
    RSS addict
    Join Date
    Oct 2005
    Location
    London
    Posts
    5
    I have tried using approach similar to what you suggested, by appending a querystring variable with a random value to the URL.

    Example:
    <param name="movie" value="<%= Application("cfg_RootURL") %>/App_Themes/<%= Session("usr_Theme") %>/_flash/Toolbar_Left.swf?nocache=<%= DateTime.Now().Millisecond %>" />


    This approach unfortunately doesnt work...

    Any other suggestions?

  5. #5
    Senior Member Bernz's Avatar
    Join Date
    Jun 2005
    Location
    Mid-Eastern U.S.
    Posts
    161
    Not that I really know what's going on over there on your computer, but it sounds like the problem might be elsewhere that your browser's cache.

    Are you absolutely sure that it's not downloading the same, unchanged file?

    Try clicking and dragging the SWF file directly into your browser window and see what happens.

  6. #6
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    There are ways in HTML to tell the browser not to cache the webpage, do a google search for
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    However, I have seen post where this doesnt always work for flash.

    If you are deleting all of your cache, it should be opening up the right one. Ive always done it that way with no problems.

  7. #7
    Member
    Join Date
    Jul 2002
    Location
    Sweden
    Posts
    45
    There is a plugin for Firefox called WebDeveloper (can be fond on the mozilla download page) that are great for disable stuff like cache.

  8. #8
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    I fully sign, what skatemaster said.. the WebDeveloper plugin rocks.
    The "disable Cache" of this plugin disables both, memory and disk cache,
    which might have been your problem.

    @DallasNYC the pragma no-cache won't work for movies, that get loaded
    withing flash..

    [edit]

    And make sure you got no proxie that caches your documents..
    Might be a transparent proxie, the liveHttpHeaders plugin for
    Firefox helps finding out
    My letters on the F1 key have faded, how are yours today?

  9. #9
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    McUsher, thanks for clarifiying that. So is it right to say that pragma-nocache works for the flash movie embeded in the HTML? Adiding a parameter to the loadMovie() target would take of caching of loaded movies.

    Ive not heard of WebDeveloper, I will be sure to check that out

  10. #10
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    To be honest i am not sure..
    The meta no-cache tags don't work as they should.. some proxies/browsers seem
    to ignore em, i have little clue to be honest.. Firefox with the memory/disk cache duality does for example.

    Loading movies inside flash with a cache blocking variable like:
    loadMovie("ttt.swf?version="+new Date().getTime(); Would be
    ok if you don't forget to take it out after you developing period...

    But mostly you will forget about that tag, and when it comes that
    caching your flash would be a good thing ..

    A real good thing would be something like
    loadMovie("bla.swf?version="+_global.VERSION); if there
    were a possibility to autoincrement _global.VERSION each
    time the movie is published..
    But i have no idea, if this could be achieved in any way...
    My letters on the F1 key have faded, how are yours today?

  11. #11
    Senior Member
    Join Date
    Oct 2003
    Posts
    1,354
    I agree, leaving a cache blocking parameter in your script could eat up your clients bandwidth.

    That webDeveloper extension looks like a good solution.

  12. #12
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    I fully agree on that webDev ext. ... it helps so much when developping ))
    My letters on the F1 key have faded, how are yours today?

  13. #13
    Senior Member random25's Avatar
    Join Date
    Apr 2002
    Posts
    566
    This is how I do it.

    Here is the html that I use to embed the main swf:
    HTML Code:
    <script language="JavaScript">
    <!--
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'
    +' width="100%" height="100%" id="holder" align="middle" scale="noscale"> '
    +' <PARAM NAME=movie VALUE="movie2.swf?' + new Date().getTime() + '"> '
    +' <PARAM NAME=loop VALUE=false>'
    +' <PARAM NAME=menu VALUE=false> '
    +'<PARAM NAME=quality VALUE=high> '
    +' <PARAM NAME=bgcolor VALUE=#000000> '
    +' <PARAM NAME=scale VALUE=noscale> '
    +' <EMBED src="movie2.swf?' + new Date().getTime() + '" quality="high" menu="false" bgcolor="#000000" '
    +' width="100%" height="100%" scale="noscale" name="holder" wmode="opaque" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"' 
    +' PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer">'
    +' </EMBED></OBJECT>');
    //-->
    </script>
    This will load the swf with a different name each time, so it doesnt play any old versions that may be in the cache.

    Also this completely stops the flash right click menu in firefox


    The action script on my buttons in the main swf:
    Code:
    on (release)
    {
        loadMovie("home.swf?" add random(9999), dummy);
    }
    This will load the swf with a different name each time, so it doesnt play any old versions that may be in the cache.
    Last edited by random25; 11-25-2005 at 10:31 PM.

    If you want to make an apple pie from scratch, you must first create the universe. Carl Sagan

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center