Disable caching YouTube videos
YouTube achieved quite a feat when they made youtube videos work with cache. However, this is causing a problem on my ajax site and would like to know if there is a way to disable youtube videos being cached. Especially in Internet Explorer.
I cannot disable caching for the 开发者_StackOverflowwhole page as I need caching to work for images and other content for speed reasons.
Any one know any solutions?
Just make sure that each time user is downloading from an unique URL. Your player code contains something like this:
http://www.youtube.com/v/sMiUpl_6jI0?fs=1&hl=en_GB
That is URL to the YouTube player. All you have to do is add new randomly generated token at the end, like (PHP example):
http://www.youtube.com/v/sMiUpl_6jI0?fs=1&hl=en_GB&noCachePlease=<?php echo uniqid() ?>
Each time you visit the page that URL will contain an unique token so the browser won't use any cache mechanisms.
This meta tags could help:
<meta http-equiv="Expires" content="0">
or
<meta http-equiv="Pragma" content="no-cache">
I believe the second one is what you are looking for. Look it up, for sure some one has a nice tutorial.
As I recall, it is not possible to clear it, unless user does by his own means.
cheers
精彩评论