-
Custom User Title
How to prevent caching of swf files
Last edited by Incrue; 04-17-2005 at 09:14 AM.
-
Yes we can
as it says there:
"SWFs, like other documents and media retrieved by a Web browser, are often saved, or cached, locally on the user's hard drive. The next time that media is requested the Web browser may load the file from the cache instead of downloading it over the network. This might be desirable for a Flash movie whose content doesn't change often but undesirable for SWFs that are updated frequently with new content or information."
so in return it doesn´t make that much sense not to cache games which normally don´t have changed content each time.
i guess the reason why you want to avoid caching is to achieve protection of your content against theft.well,disabling swf caching doesn´t help that much there as there are several other ways to grab a swf if someone wants to.
on the other side disabling caching means exploading traffic for you (if you have a paid host more costs,if you have a free host quickly exceeded bandwidth quota) and a negative game experience for your game player (as he has to load the game each time though he wouldn´t need to).
-
Custom User Title
Originally posted by tomsamson
much there as there are several other ways to grab a swf if someone wants to.
"divide to conker"
-
Yes we can
hm,yeah,generally doing many different things to protect your stuff may seem like a good idea but in this case i think the negative side effects heavily outweight the minimum advantage you gain on the protection side
-
CRT Boy
hmm actually, i know director can embeded flash in it. but can director be decompile and extract the swf out?
-
Custom User Title
Mcleun,we already talked about this, search the board for "flash + director for security"
Tomsamsom, so, what are the other ways he can get the swf?Knowing his name and typing in the browser window?
I ask myself, if people can play it in cache, why they would need to go to my site, anyway?
Last edited by Incrue; 04-17-2005 at 12:47 PM.
-
Yes we can
hm,there are several ways to get files from a server,no need to list em all i think.
the casual gamer will probably more like to just visit a site and play the game rather than going to his cache,looking for all files connected to a game and the get it working on his machine.
yeah,thieves will do that or other things but éven if protecting your stuff is important to you i´d choose working on the product itself and giving your adience a good feel rather than focussing on protecting your stuff in a way which is negative for your audience.
better concepts for protecting your stuff are splitting it into several files in different folders,using obfucators for the code and loading small files like map files each time on runtime if you want to do that
-
CRT Boy
ohh sorry my bad, too long never visit this forum, didnt know it.
-
Custom User Title
Tom, please check your PM
-
Custom User Title
Rigth, i got your point
But, what if...the swf is not in my site, anyway?If i have a php who conects to my other server trough ftp, ( in wich the swf is in), copy the swf, paste in my first server, send it to the browser and them delete the swf?
-
Custom User Title
This thing is not working...
Anyway, i should not worry about this
Today we have flashincrypt, all he has to do is hide the url check and there will be no more problems at all
-
Senior Member
as well as using pragma no cache and expired tags, there is another way.
If you have a high score table for example retrieved from a DB using PHP (or whatever), you might make a call like this:
Code:
loadVariables("highScore.php?list=10","0");
but as flash may use this several times inside a movie, you may receive cached data rather than the freshest stuff available so I use this
Code:
unique=new Date().getTime();
this.loadVariables("highScore.php?list=10&unique="+unique);
This then adds the current date and time as a parameter (which is largely ignored by my PHP script but means that it will never be the same as previous calls to the script and therefore never cached.
I have used this quite a bit in the past and I believe it originally came from Flashgurus site but I can't find it again.
-
Custom User Title
I was thinking about what Tom and Lapo sayd and came up with this weird idea:
1. Have your game splited between many swf to be loaded dynamically.One of them has just the code, and this is the main swf cos he is the one who runs the entire game and who loads the other swfs.As he have only the code he may not be that heavy, i gess...
2 Find a way to let all of the other swfs in cache, but the main.swf is taken by my php in other server and sended to the browser with no cache
I gess it may solve those bandwith stuff and also prevent someone to take the main.swf from my server, since they dont know the adress of my other server
BUt this pragma and header stuff are not working...
RazorMedia, this stuff can send a secret variable to inside the swf?I mean, it can be used to load some variables inside flash so that noone will NEVER see those variables,(cos they dont end up in cache)and to do this i must load the php two times, and make the variables only came if is the first call, am i rigth??
This parametter stuff would also work too if i want to call swfs but not phps?
-
Hype over content...
Incrue, why this big hang up about protecting your games ?
In the grand scheme of things it's not that important. If your games are for clients, then you're getting paid anyway.
RazoRmedia's example is just a simple cache killer, I usually just add a random number to it rather than the time. It's a way of forcing an up to date response from the server, so it's handy for things like hi-score files and constantly updated xml.
I'm assuming you use FireFox ? If so, grab the essential Live HTTP Headers extension and see exaclty how un-safe everything is ( Again with Firefox, go to a page with a swf, then from the Tools menu select Page info and then the media tab. Grabbing files and seeing what data is passed is so easy it's untrue ).
To be honest mate, I'd rather see some great games from you rather than you beating yourself up over protecting things.
Squize.
-
Senior Member
sorry, mine wasn't a protection thing, rather a tool to ensure the user gets the most updated content when loading from external files.
must remember to read through posts fully before opening mouth
-
Custom User Title
Squize: Thanks for the feedback, i saw how firefox could show that...i think i was getting obsessive about this protection stuff, and giving me headaches...
Yeah, you are rigth, i should focus in build something...
Lapo: Dont worry about you sayng the wrong thing; to mee what you sayd could be used to lots of goals
-
curiouser and curiouser
is there a way to use the technique that RazoRmedia mentioned to stop ordinary txt and xml files that are loaded into the swf from being cached?
(I'm using sendAndLoad if that impacts on the technique at all)
-
Senior Member
Originally posted by LittleRed
is there a way to use the technique that RazoRmedia mentioned to stop ordinary txt and xml files that are loaded into the swf from being cached?
(I'm using sendAndLoad if that impacts on the technique at all)
yes, course there is, if you're using sendandload, simply use the code below in much the same way to create a unique identifier which will be sent.
Code:
unique=new Date().getTime();
var bruce = new LoadVars();
var xmlRec = new XML();
xmlRec.onLoad = function()
{
trace( this );
}
bruce.sendAndLoad("highScore.php?list=10&unique="+unique, xmlRec , "GET");
-
curiouser and curiouser
thanks for the reply.
sorry if I'm being dense, but I'm not quite following how this prevents caching.
This method sends a unique variable through to the receiving php script, but how does this affect the text file that the php saves?
If I load the text file back in, do I need the unique identifier to ensure that this is the most current version?
-
Senior Member
it prevents caching via the following:
If I use
bruce.sendAndLoad("highScore.php?list=10", xmlRec , "GET");
then it requests data from highScore.php and returns it. If I do this a number of times, as the data has already been returned, it could deliver cached data and not the latest data.
If I send the unique identifier as below, it will always send a 'new' request and therefore the latest data would always be returned.
bruce.sendAndLoad("highScore.php?list=10&unique="+ unique, xmlRec , "GET");
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|