问题标签 [jquery-cookie]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
592 浏览

jquery - jQuery / Cookie 弹出问题

我最近在这个问题上得到了帮助,但无法联系到帮助我的人。

下面的代码每 24 小时弹出一次显示,并创建一个每天过期的 cookie。我遇到的问题是,当 cookie 过期时,会创建一个新的,但不会显示弹出框。我在一个有很多用户的网站上运行它,所有人都说它出现了一次,再也没有出现过。

我对 HTML 和 CSS 很好,但这 100% 超出了我的范围。我认为 cookie 需要从我在互联网上看到的内容中删除而不是更新,但我预计会出错。

任何帮助将不胜感激!提前谢谢了。

0 投票
1 回答
1041 浏览

jquery - 如何在一行中使用 jQuery cookie 插件设置多个 cookie?

我使用jquery Cookie 插件已经有一段时间了。对于设置多个 cookie,我通常这样做:

而对于删除多个 cookie,我通常会这样做:

我只是想知道,有什么方法可以做到这一点吗?就像是:

提前致谢!

PS上面的代码只是我的假设。

0 投票
1 回答
1375 浏览

jquery - 重定向到多个域的 jQuery cookie

这是我正在尝试做的事情:

  • subdomain.domain1.com/splashpage.html 上的启动页
  • 用户单击按钮并被重定向到 subdomain.domain1.com/landingpage.html 或 subdomain.domain2.com/landingpage.html
  • 在 subdomain.domain1.com/splashpage.html 上设置的 Cookie 会记住他们的选择并在下次自动重定向它们

我已经使用 jQuery cookies 插件和一个非常有用的大纲成功创建了 cookie:记住首选语言

我用来设置 cookie 的代码:

几个问题:

  • eastwest变量 URL 似乎与url变量相关,它们重定向到 domain1.com/subdomain.domain1.com/landingpage.html
  • 在我的 /landingpage.html 上都有一个我无法编辑的基本 href,所以:<base href="http://subdomain.domain1.com/landingpage.html" /><base href="http://subdomain.domain2.com/landingpage.html" />

有谁知道我需要对代码进行哪些调整才能正确地将用户重定向到正确的 URL/域?

非常感谢。

0 投票
4 回答
18450 浏览

javascript - (jQuery) 单击 cookie 时保存复选框状态

关于这个功能有很多话题,但我似乎无法让它工作。我已经用谷歌搜索了这个特定的案例,一堆链接让我在这里,但奇怪的是我似乎无法让它们工作。我所做的唯一工作如下: http ://dl.dropbox.com/u/2238080/a/!old/z.htm 但如您所见,它不存储盒子的状态是未经检查。

问候, 鲁本

0 投票
1 回答
139 浏览

jquery - 在选择选项更改时删除旧 cookie

我有一个选择选项,我想在每次点击时保存选定的值。这是我的脚本

问题被bill_client_id保存了 2 次(我可以在 Firebug 中看到它们)并且在准备好文档时我只得到了旧的bill_client_id

0 投票
2 回答
648 浏览

javascript - 无法使用 jQuery-cookie 插件写入/读取 cookie

我需要编写和读取一个 cookie,我想使用jquery-cookie插件。

但是,我无法设法存储 cookie 并将其读回。

这是一个 MWE

我希望看到aValue在控制台中打印出来,而它打印出来null,即未找到 cookie。

我觉得我在这里缺少一些明显的东西。

0 投票
0 回答
260 浏览

jquery - 除非您单击“X”按钮,否则如何显示 qTip 气球

我有下一个代码

我有一些问题:

1.如果我通过徽标前面的点击箭头,qTip 气球(希望它保持打开)关闭。

2. 仅在单击 X(关闭按钮)时无法关闭:我想让它在每次刷新页面时重新打开,除非您之前单击过 X 按钮。

有人可以指导我吗?

0 投票
2 回答
4134 浏览

jquery - Getting jquery.cookie.js to read a cookie and redirect

I'm quite new to jQuery, and I'm trying to get the jQuery plugin, jquery.cookie.js to write a cookie, and then redirect based on the cookie value. Here's an outline of what I'm trying to accomplish:

Upon landing on a splash page, the user selects their language preference. They can also check a "remember me" checkbox, which writes the cookie lang-pref with a value of either en or fr. Upon future visits, visitors are redirected to either an English homepage or a French homepage.

Here's my code for writing the cookie:

And here is the code to read the cookie, which I'm reasonably sure I've screwed up, as the redirect doesn't work. I'm not sure how to fix it, though:

I've looked over the docs for this plugin, but I'm still not sure how to use the actual cookie's value to perform actions: the examples given on the project's GitHub page, for example, shows how to read a cookie, simply by doing what I've done in the code above.

Long story short, I can't figure out how to read the value of a cookie, and then use said value to perform a redirect.

0 投票
1 回答
507 浏览

jquery - 同位素和 jquery.cookie

我有一个用复选框过滤的 jquery 同位素。复选框的值是使用 jquery cookie 检索的,我想使用复选框的值设置初始过滤器。我做了一个jsfiddle:http: //jsfiddle.net/qdzcP/10/

我正在创建一个新变量

然后在我加载同位素时将变量加载为过滤器

但是,初始化的过滤器似乎不正确。有人能指出我正确的方向吗?

非常感谢!

0 投票
1 回答
403 浏览

jquery - 记住 jQuery 在页面刷新和设置 Jquery cookie 插件后隐藏或显示

好的,在我放入 cookie 插件后,这些按钮甚至都不起作用。