[英]setting a cookie that expire on second load of a page
I have to launch a modal window only on some pages and only when is the first time that, for the specified user, that particular page is loaded. 我只需要在某些页面上启动模式窗口,并且仅在指定用户首次加载该特定页面时才启动。
How can i make this? 我该怎么做? I want to use javascript. 我想使用JavaScript。
I think i have to set a cookie and set a variable that is the page loading but how? 我想我必须设置一个cookie并设置一个页面加载变量,但是如何?
You have to set cooike for each of that page... 您必须为该页面的每个页面设置cooike ...
jQuery.cookie('test', true, {expires: 30})
So you will have a cookie for current opened page and for 30 days. 因此,对于当前打开的页面,您将拥有30天的Cookie。 Default value of the path attribute of the cookie is the page that created the cookie. cookie的path属性的默认值是创建cookie的页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.