Wednesday, April 22, 2009

flex 3 no cache

How to not cache your main application in the browser is the question?

First we create a .htaccess file which allows the browser to be tricked into thinking it has 999 different applications

in your htaccess file use
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^main[0-9]+\.swf main.swf [NC]



Using PHP I create a file instead of Flex's html loading file called index.php

here I've replaced the swf name to a random number



AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+
'&MMdoctitle='+MMdoctitle+"",
"width", "1000",
"height", "678",
"align", "middle",
"id", "main",
"quality", "high",
"bgcolor", "#ffffff",
"name", "massmc_",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);

} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "main",
"width", "1000",
"height", "678",
"align", "middle",
"id", "main",
"quality", "high",
"bgcolor", "#ffffff",
"name", "main",

No comments:

Post a Comment

Got a Suggestion please let us know