对话框“不再显示此内容” boolean: 在哪里存储价值?

发布于 2024-12-27 05:24:46 字数 180 浏览 1 评论 0原文

我有一个 JavaScript 弹出对话框,每当用户调用特定事件时就会出现,这可能很烦人。

我在服务器端使用带有数据库连接的 Ruby on Rails。

所以我正在考虑一个输入复选框,以便对话框不会再次显示,但用户应该能够再次更改该值。

我将在哪里存储布尔值?在数据库、会话、甚至cookie中?

I have a JavaScript pop-up dialog that appears whenever a user calls a specific event, which can be annoying.

I am using Ruby on Rails on server-side with a database connection.

So I am thinking about an input checkbox so that the dialog won't show up again, but the user should be able to change the value again.

Where would I store the boolean value for that? In the database, session, or even cookie?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请持续率性 2025-01-03 05:24:46
                      The answer is, "it depends".

           If you want the setting to persist across visits to
          the site, even from different computers, store it in
                  the user's profile in your database.

            If you don't have a user database, store it in a
                           persistent cookie.

         If you don't want it to persist (too long), store it in
                           the (PHP?) session.

          If you won't want it to persist at all, store it in a
          per-session cookie (i.e. one without an expiry date)

                      The answer is, "it depends".

           If you want the setting to persist across visits to
          the site, even from different computers, store it in
                  the user's profile in your database.

            If you don't have a user database, store it in a
                           persistent cookie.

         If you don't want it to persist (too long), store it in
                           the (PHP?) session.

          If you won't want it to persist at all, store it in a
          per-session cookie (i.e. one without an expiry date)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文