禁用缓存YouTube视频 [英] Disable caching YouTube videos
问题描述
我无法为整个页面禁用缓存,因为我需要缓存来处理图像和其他内容,以提高速度。
任何一个人都知道任何解决方案?
解决方案只要确保每次用户从唯一的网址。您的播放器代码包含如下内容:
http://www.youtube.com/v/sMiUpl_6jI0?fs=1& amp; hl = zh_CN
这是YouTube播放器的网址。所有你需要做的就是添加新的随机生成的令牌,如(PHP示例):$ b .youtube.com / v / sMiUpl_6jI0?fs = 1& amp; hl = en_GB& amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp;
每次访问网页时,网址都会包含唯一的令牌,因此浏览器不会使用缓存机制。
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 whole 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.
这篇关于禁用缓存YouTube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!