javascript - 使用 javascript 在两个页面之间保留值

标签 javascript jquery html persistent-storage

我有一个 html 页面,其中现在存储了一些用户选择的值,并且希望在另一个 html 页面上使用这些值。

我在模块中使用 jquery,并且已经尝试过 window.name 和 window.localStorage,但它们不会在两个页面之间保留值。

所以请帮我解决这个问题。

最佳答案

如果您不想要 cookie,并且如果您从第一页定向到第二页,那么如何将值作为 GET 变量传递到下一页:

http://example.com/newpage.html?var1=blah?var2=blerg

然后您可以使用 window.location.search 访问该数据。

关于javascript - 使用 javascript 在两个页面之间保留值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2477784/

相关文章:

javascript - boolean 问题

javascript - JQuery 触发更改甚至组合框的选定值在页面加载时检查

javascript - 将信息添加到按钮上的 txt 文件单击 ASP.NET

javascript - 我如何才能等到 IndexedDB 实例关闭?

javascript - 错误: Cannot read property 'replaceChild' of undefined

javascript - 让你的脚本每隔一段时间重复运行一次?

javascript - 使用 Mongoose 模式将多个选择元素值的值存储到 MongoDB 中的数组中

javascript - Ajax执行多次

javascript - 单击react.js 切换列表的背景颜色

html - CSS — 响应式水平导航,下方有子导航