
When developers create Flash movies they often deploy them over the Web as SWF files. When users view pages with SWF files on them, their Web browser program aims to minimize the amount of data fetched. The browser stores a cache copy of certain data items and files from websites when users visit them. This means that if you refresh a page with an SWF file on it, your browser may not fetch it again over the network, but present you with the cached version instead.
The Problem
- Browser caching is a key element in network efficiency. The fact that Web browsers cache media content makes the experience of browsing faster, particularly for large media files such as Flash movies. When developers work on Flash files, they use source FLA files, exporting these to SWF files for uploading and viewing over the Web. During the development phase of a Web project a Flash file may undergo many changes. Once a file has been deployed, it may also undergo future developments, for example to update its content. This means that the SWF file can change at any time.
Effects
- The effects of problems with SWF files being cached by the browser affect both the developer and the user. If a user is viewing a page and is unaware that they are using an outdated version of the SWF file on the site, they may receive invalid information or be unable to successfully access website services. The caching issue is also a problem for developers. When you develop a Web project, it is common to repeatedly make small, incremental changes, testing your pages between each alteration. If a developer attempts to alter a Flash file and receives the previous version each time they view it in the browser, this can therefore confuse the task at hand.
Browser Cache Approaches
- Users can clear, or "flush," the cache within the browser whenever they like. When refreshing a page using the keyboard, you can instruct the browser to flush the cache before reloading the content of a page. Rather than pressing "Ctrl+R" or "F5" you can use "Ctrl+Shift+R" or "Ctrl+F5" to force this behavior. To clear all of the current cache in the browser, you can alternatively use the "Tools," "Menu" or "Safety" menu depending on your own browser program. These techniques are not always reliable. The fact that SWF files play in the Flash Player plug-in can make clearing the cache difficult.
Scripting Approaches
- To prevent the user's browser from using the cached version of an SWF file, some developers use scripting. When a page uses JavaScript to embed an SWF file, it is possible to add data variables to pass into the file. By adding a random variable to the SWF URL, developers can force the browser to reload the SWF file each time. The issue also affects internal code for Flash movies. When SWF files read data from external sources, this data can also become cached. The approach is typically the same for this issue, with developers adding random variables to their URL codes to force the newest resources to load.