browser cache

3781
35
Jump to solution
05-08-2012 07:38 AM
EricGardecki
Occasional Contributor
It seems like I often have to clear my browser's cache after updating some things with my web app or else the changes do not show.  Clearing the REST cache doesn't take care of everything.  I think the average user would not think to clear their cache let alone even know how and they would not see changes/fixes.  Is there a way to force it on load somehow?  If not, Any ideas on how to get people to understand that it may be necessary?  I doubt that a snippet in a help page would be enough....plus when would they even know that a change has been made and they need to clear it?

thanks!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MattiasEkström
Occasional Contributor III
sorry, your code above was a mix of what it should be in the index.template.html and the index.html.
In the index.html it should be:
swfobject.embedSWF(              "index.swf?ts=" + new Date().getTime(), "flashContent",                 "100%", "100%",                 swfVersionStr, xiSwfUrlStr,                 flashvars, params, attributes);

View solution in original post

0 Kudos
35 Replies
philippschnetzer
Occasional Contributor III
One thing that helps is using a browser that doesn't store a cache: Google Chrome Incognito, Firefox Private browsing, etc...

Maybe just let the users know to use such a browser in a splash page or something....

Other than that I do not know how to enforce an automatic browser cache cleansing upon load....
0 Kudos
MattiasEkström
Occasional Contributor III
You can modify the configmanager.as and add timestamps to the URLs when swf-files and xml-files are loaded, which will prevent the browser from getting it from the cache memory.
Take a look at this thread: http://forums.arcgis.com/threads/16664-Preventing-client-side-caching-of-the-Flex-Viewer
0 Kudos
jessebelcher
New Contributor
mattias_j,


I have look through the other thread.. I have downloaded the file.. i am not sure where or what i need to change.  I cant find the ConfigManager.as.. i am fairly new to this.

Any ideas?

Jesse B.
0 Kudos
EricGardecki
Occasional Contributor
I'm with you on that one.  Turns out that that file is in the source for the viewer.  So I downloaded that, opened in flash builder (first time using it), fumbled my way around in there all morning, and once I got the build exported it didn't work anyway (viewer doesn't load at all).  I have no idea if I did something wrong in FB or if I missed some of the edited lines in Robert's attachment.  I opened his file, found the lines with the timestamp, and edited those lines in the 2.5 version.

I spent a long time and have no idea what i'm doing in the source, or in FB itself.  Unless someone can point me to what I may have done wrong I think i'm screwed.

I spent so much time setting up the flex viewer and now something like this is making me regret using it.  How can something like this get overlooked?  Silly me, if I update my viewer or data I want the end users to see the changes...
0 Kudos
MattiasEkström
Occasional Contributor III
Sorry I forgot to mention that the solution in that thread is for those who is working with the source code i FlashBuilder. And that the ConfigManager.as file was for version 2.3.1.
Well I started a new project with the source code for 2.5 and made the changes to the ConfigManager.as, and it works for me at least.
Eric, did you first try to running the application without any changes at all? if that works you could try the new ConfigManager.as attached to this post. If not you should read this carefully and start over.
Or you could try to use the compiled version and change the index.swf to the one I included in ConfigManager_v2.5.zip, that's my compiled file after making the changes to the ConfigManager. I can't guarantee that it'll work, but it may be worth a try.
Jesse and other who use the compiled version could try this as well. But I'm not sure if there might be some of my FB-settings or something else that will make any other changes to my compiled index.swf compared to the one you get when dowloading the compiled version.
0 Kudos
jessebelcher
New Contributor
mattias_j,

Thanks for the reply..  i am trying to get the basics down before i jump into the non compiled Api version..

I have replaced my index.swf with the one from your post.. i am testing it now. Good news is everything still works as it did before. Not sure about the cache as of yet but i will let you know.

Thank you for you help on this.
0 Kudos
EricGardecki
Occasional Contributor
Mattias, thanks for the response.

I tried your index.swf and get the same result as the one I compiled.  The url to the viewer appears to find something, as in no browser errors, but I get a blank white screen.  Flash loads but no viewer.  I get no errors anywhere.  This same testing application works just fine with the esri compiled version of the file.

I then again loaded the source in FB and simply tried to run it before doing anything (as in your link) and I get an error saying it can't find index.html.  All I did was import the project and add the sdk as is and there are files missing??

I'm thoroughly frustrated as to why either thing isn't working and don't know what else to do.  Any ideas?  Thanks
0 Kudos
MattiasEkström
Occasional Contributor III
Eric, the problem with a blank white screen and no errors I've had before. I could solve that by installing a new version of flash player. I don't know what was wrong, the version I had was supposed to be working. Try updating your flash player and see that changes anything.
The index.html is supposed to be created when building the project, it's based on the index.template.html in the html-template folder.
0 Kudos
EricGardecki
Occasional Contributor
My flash players are all up to date already so there was nothing to update. I tried it in multiple browsers and multiple computers as well.

As for the index.html.  I was just trying to follow the developer help page you linked to.  It suggested running the index.mxml within FB, prior to compiling, to be sure it's working.  That's when I got that error.

That being said, I decided to try again and ignore that error.  I replaced the ConfigManager.as in the project with yours that was posted above, compiled, and tested it out.  It is loading just fine now.  I then tried a couple quick changes to test out the cache thing. Changes to a widget happened without having to clear the browser cache, however, when I changed something in a popup config I could not see the change without clearing the browser cache.  Apparently there are some limitations to what this fix applies to.  Do you have a handle on what those limitations may be?  So far it seems that it applies to widgets and changes to the config.xml....which is definitely great...but what does it not apply to and why?  And can this be changed?

Thanks for your help.  I'm glad to have this working.

Oh... the compile creates several *.swz files along with the index.swf that apparently match the version of FB.  Must I use the versions I created or can i just take the index.swf alone out and add to my viewer?
0 Kudos