Hi, I'm wondering if it's possible to somehow make Flash download the panorama xml files and images again after I make some changes, instead of loading it from cache? I know you can clear the browser cache and the flash cache, but that's not very elegant to ask the user to do this. Is there some other way to automatically make flash re-download the content?
Regards,
Karel
Questions about flash caching
-
-
xml is fairly simple
tour.xml?v=2
the v is just a variable, here you can use it as a version.
For the images.. you're out of luck. Update your xml and use a different name for your image. -
I knew about the xml trick but that's not very elegant. sucks..
-
What I do is to change the name of the folder where the tour is and use htaccess to redirect the user.
For instance, I would have the tour at the address "http://example.com/tour-1.0" and the following configuration in .htaccess:
Redirect 301 /tour/ /tour-1.0
Redirect 301 /tour /tour-1.0I could then give the customer the address "http://example.com/tour". If later I need to update something, I would change the folder name and configuration to "tour-1.1".
The problem with this method is that the user will see the URL change. But I haven't had any browser or flash caching problems while using it.
Note: It's probably also good to disable caching in .htaccess with:
ExpiresActive On
ExpiresDefault A0 -
If you use php or asp, you can always use non-caching headers.
I knew about the xml trick but that's not very elegant. sucks..
-
I'm looking into using changing the header information throught he .htaccess file on the webserver for xml files, making them expire within a few hours. And longer for other content.
This is what goes in the htaccess file:
ExpiresActive On
<Files *.xml>
ExpiresDefault "access plus 1 hours"
Header set Cache-Control "public,max-age=3600"
</Files> -
Unfortunately, I've come to the conclusion that Flash doesn't really respect the cache headers as it should. That's why simply configuring the cache expiry time isn't enough.
-
Klaus:
Would it be possible to implement versioning for the xml, images and other content in the krpano viewer when it is downloading the content?
For example, we could put a "version=1.0" string somewhere in the javascript and pass it along to the swf, and then krpano would append "?v=versionumber" to all the gets for xml and images and other content automatically?
This way we could get around the caching issue. Anytime we change something and want people to re-download, or invlaidate their cache, we could just change the version number we pass along to the viewer in one single spot.
Is this a possibility? -
Is that a question or a statement? That method works fine and does what you suggest.
-
It's a question, I know it works fine, but I was asking Klaus for an implementation in the viewer directly so that it would be easier for us to manage (at least the way I see it). If you can just pass the version number to krpano in the javascript in 1 place, then you don't have to change many xml files yourself with version numbers in case you manage a big project, which is what my project is going to become in the future. I'm asking more for an automated feature in krpano for this...
-
And to clearify a bit more, say I have a panorama defined in pano.xml, then I could pass that pano.xml file to krpano, and also a version parameter (optional).
In this case, krpano would then apply ?v=versionumber to the get automatically when it downloads pano.xml, but also, for all the xml files which are included in pano.xml using the include statements, it would aso append the ?v=versionumber when downloading. And if possible, also for the images and other content defined in each of those xml files.
That way, we can manage the version number in 1 place and krpano does the rest for us automatically. Hope this is more clear to understand what I mean. -
I managed to implement some of this in my own code.
In my wordpress plugin I added a field "version", and when the plugin embeds the krpano swf in a post, it automatically passes this version number to the swf via the javascript interface and the xml being loaded by the swf.
inside my xml i have a "loadpanorama" function where I use the version number variable and append it to the url of the xml when I use krpano's loadpano function.
However I'm left with 2 problems:
1. I can't implement this for xml files which krpano loads via the "include" statements :(
2. This is only for xml files and not other content such as images and sounds etc.
If I had a way to append the version number to the url in the include statements automatically then it would be a big help. This is why if the versioning was implemented in krpano itself it would be better. -
Hi,
there is an undocumented behavior for urls that could help here:
when using inside an url a sequence like this - %$XXX% - the XXX can be the name of a krpano variable, but with one limitation - the variable must be defined BEFORE the current xml/pano/scene,
e.g. to avoid simply any caching urls like this are possible:
or for versioning:
define a "panoversion" variable in the html:
and in the xml:(I will add that to the next documentation update)
best regards,
Klaus -
Wow thanks Klaus! I have one question though, to set the variable, do I always have to use addVariable()? The way I pass the variable to krpano now in the script is after the embedpano function in html, I call the krpano.set() function to set the variable. Would this also work ok? Also I see there's a $ added to the variable name when refering to it in the include, not a typo right?
-
Ok seems to work. I decided to change the code to use AddVariable(), this way I can set the variable before loading the first XML. Thanks a lot Klaus :)
-
Hi All
I'm really new for krpano. Can anyone give me full example for this. I don't have a clue where to place the code for this method.
or for versioning:
define a "panoversion" variable in the html:and in the xml:
Thanks in advace.
-
goee:
in your html you put this to load the viewer:
<script>
var viewer = createPanoViewer({swf:"http://url/krpano.swf",target:"id_of_div"});
viewer.addVariable("version", "1");
viewer.addVariable("xml", "tour.xml");
viewer.embed();
</script>and in your tour.xml you put this:
<include url="controls.xml?v=%$version%" />
-
with the php function filmtime you could check when a file is modified. If you save the index.php file again, then it could generate a new versionnumber automatically
-
I have a PHP generated page which displays pano viewer. when i edit the page and add more pan images and then rerun script to rebuild the pans, the new pans do not show on my page until i clear the browser cache. i tried to included some of the "add a query to url to prevent caching" tricks mentioned here, but they do not work.
my code to display player is this:
PHP
Display More<iframe width="960" height="600" frameborder="0" allowfullscreen="" src="/sites/boldimaging.com/files/images/property/%node:nid/panorama/vtour/tour.html?r=<?php echo time();?>"> <!DOCTYPE html> <html> <head> <link href="skin/buttons/vt.ico" rel="SHORTCUT ICON"> <style> </head> <body> <script src="tour.js"></script> <div id="pano" style="width:100%; height:100%; background-color:#FFF;"> <embed id="krpanoSWFObject" width="100%" height="100%" flashvars="browser.useragent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0&xml=tour.xml?r=<?php echo time();?>" allowscriptaccess="always" allowfullscreen="true" quality="high" bgcolor="#FFFFFF" name="krpanoSWFObject" style="undefined" src="vt14.swf" type="application/x-shockwave-flash"> </div> </body> </html> </iframe>
any suggestions?
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!