微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – 传递给history.pushState的状态对象是什么?

stateObj是传递给history.pushState的,它是做什么的?

例如,history.pushState(stateObj,title,url);

解决方法

状态对象,as defined by the spec,是您,作者想要与该状态相关联的任何对象:

Pages can add state objects between their entry in the session history and the next (“forward”) entry. These are then returned to the script when the user (or script) goes back in the history

MDN具有更实用(特定于Firefox的)定义:

The state object can be anything that you can pass to JSON.stringify. Because Firefox saves state objects to the user’s disk so they can be restored after the user restarts her browser,we impose a size limit of 640k characters on the JSON representation of a state object.

原文地址:https://www.jb51.cc/js/153833.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐