ajax – 哪一个更好的pushstate或location.hash?
发布时间:2020-12-16 03:10:33 所属栏目:百科 来源:网络整理
导读:window.location.hash vs HTML5 history.pushstate。哪一个会更好地满足与ajax请求的url,为什么? 谢谢。 location.hash 比 history.pushState 方法有更好的支持。 pushState方法的优点是您可以将状态绑定到历史记录条目。 如果您不需要此状态对象,我建议
window.location.hash vs HTML5 history.pushstate。哪一个会更好地满足与ajax请求的url,为什么?
谢谢。 location.hash 比
history.pushState 方法有更好的支持。
pushState方法的优点是您可以将状态绑定到历史记录条目。 如果您不需要此状态对象,我建议使用location.hash属性,以更好地兼容旧版浏览器。 location.hash = 'new-hash'; console.log(history.state); // null or undefined history.pushState({extraData: "some state info"},'','new-hash'); //<--- console.log(history.state); // [object Object] = {"extraData": "some state info"} (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ruby-on-rails – Rails在控制器定义中不需要索引方法吗?
- swift – 使用files数组上传MultipartFormData
- ruby-on-rails – 在Ruby中指定和执行规则
- Swift 4 WebKit webView不会加载带有附加参数的URL
- ruby-on-rails – 在部署我的Rails应用程序之前,我应该检查
- oracle – PLSQL Bind变量和Host变量之间有什么区别
- c# – 套接字和身份验证失败,因为远程方已关闭WPF中的传输流
- 正则表达式 – emacs:突出显示平衡表达式(例如,LaTeX标签)
- 详解 SiriKit - SiriKit 教程(Part 2)
- c# – 如何让Hangfire作业调度程序错开20分钟的间隔作业