我想知道如何做下面的事情。-我在我的网站上有一个Vimeo视频,这是我网站的介绍视频。-我希望视频只向用户显示一次,如果这是不可能的,每5-10次他们加载页面。
我该怎么做呢?我在JS完全是个新手。欢迎任何建议!
我找到了这个脚本,我该如何操作/使用它来完成此操作?
https://github.com/carhartl/jquery-cookie
谢谢!
发布于 2012-09-18 14:02:07
您找到的jQuery cookie插件可以做到这一点。
这段代码将帮助您入门。我不知道您希望如何加载视频,但这将帮助您入门。
$(document).ready(function() {
var video_cookie = $.cookie('have_seen_video'); // read the cookie
if (video_cookie == null) {
// user has not seen the video
// TODO: show the video
// save a cookie to indicate this user has seen the video
$.cookie('have_seen_video', true);
} else {
// user has seen video, don't show it again.
}
});
https://stackoverflow.com/questions/12470369
复制相似问题