禁用缓存YouTube视频 [英] Disable caching YouTube videos

查看:197
本文介绍了禁用缓存YouTube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTube使YouTube视频与缓存一起工作,取得了相当的成就。但是,这是我的ajax网站上的问题,并想知道是否有办法禁用YouTube缓存的视频。特别是在Internet Explorer中。

我无法为整个页面禁用缓存,因为我需要缓存来处理图像和其他内容,以提高速度。



任何一个人都知道任何解决方案?

解决方案

只要确保每次用户从唯一的网址。您的播放器代码包含如下内容:

  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&amp;hl=en_GB&amp;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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆