/    Sign up×
Community /Pin to ProfileBookmark

Help, script to rename flash file

Hi

We have hundreds of flash charts on our site.
When a flash file is updated (over written by new file)99%
of the time the updated information shows up on the browser.
When one does not update, refreshing does not help, you have to delete the browser cache, which of course is not a solution.

Stopping the html or php from caching does not help either.

I found on a flash forum a script that is supposed to rename the flash file with a random number.

Below is a test script I put in and the flash works OK, but when I look at the flash file in my browser cache it still has the same name, maybe its working correctly. I’m unsure of a way to test it. I am not sure what is really happening with the #2 and # 3 URL’s in the script.

The first URL is the location of the original file.
The script seemed to call for a copy of the original file so I created a flashcache dir.

Can someone tell me if this script is doing what it is supposed to
or maybe there is another way.

The script below is my adaptation of the sample I found which is father down.

Thanks

donbmjr

<script type=”text/javascript”>
<!–
document.write(‘<OBJECT classid=”clsid?27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0” WIDTH=”400″ HEIGHT=”600″ id=”http://www.theinsidegroove.com/charts/04finishes/johnson_jimmie.swf” ALIGN=””>’);
document.write(‘<PARAM NAME=movie VALUE=”http://www.theinsidegroove.com/flashcache/johnson_jimmie.swf?r=‘ + Math.round(Math.random() * 99999) + ‘”> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000> ‘);
document.write(‘<EMBED src=”http://www.theinsidegroove.com/flashcache/jimmie_johnson.swf?r=‘ + Math.round(Math.random() *
99999) + ‘” quality=high bgcolor=#000000 WIDTH=”400″ HEIGHT=”600″ Loop=false NAME=”http://www.theinsidegroove.com/flashcache/johnson_jimmie.swf” ALIGN=””TYPE=”application/x-shockwave-flash” PLUGINSPAGE=”http://www.macromedia.com/go/getflashplayer”></EMBED>’);
document.write(‘</OBJECT>’);
//–>
</script>

Link of the test page
[url]http://www.theinsidegroove.com/charts/04finishes/johnson-jimmie.html[/url]

Script I found

Do a javascript routine to randomise the name of the flash movie when it is called on the page
here’s some example code that I use to prevent caching:
Code:

<script type=”text/javascript”>
<!–
document.write(‘<OBJECT classid=”clsid?27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0” WIDTH=”640″ HEIGHT=”250″ id=”http://www.auction-trading.com/content/letsPlayPong.swf” ALIGN=””>’);
document.write(‘<PARAM NAME=movie VALUE=”http://www.blah.com/letsPlayPong.swf?r=‘ + Math.round(Math.random() * 99999) + ‘”> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000> ‘);
document.write(‘<EMBED src=”http://www.blah.com/letsPlayPong.swf?r=‘ + Math.round(Math.random() *
99999) + ‘” quality=high bgcolor=#000000 WIDTH=”640″ HEIGHT=”250″ NAME=”http://www.blah.com/letsPlayPong.swf” ALIGN=””TYPE=”application/x-shockwave-flash” PLUGINSPAGE=”http://www.macromedia.com/go/getflashplayer”></EMBED>’);
document.write(‘</OBJECT>’);
//–>
</script>

Note that whenever I call the path to the flash movie i do a ?variable=random number between 1 and 9999
this ensures that each time I load the page a new version of the flash movie will have to be downloaded in the browser cache

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJun 20.2004 — Hi!...when I look at the flash file in my browser cache it still has the same name...[/QUOTE]The script does not at all rename the file. It simply passes a random parameter in the url but that does not affect the file name.

Cheers - Pit
×

Success!

Help @donbmjr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...