使用JavaScript解析URL哈希/片段标识符

编程入门 行业动态 更新时间:2024-10-23 07:29:13
本文介绍了使用JavaScript解析URL哈希/片段标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

退房: jQuery BBQ

< jQuery BBQ旨在解析来自url的查询(查询字符串或片段),并进一步简化基于片段的历史记录。这是Yarin在整理纯js解决方案之前寻找的jQuery插件。具体来说, deparam.fragment() 功能完成这项工作。看看!

(我正在使用的支持网站使用了异步搜索功能,并且由于BBQ使得将整个对象放入片段中变得微不足道,所以我使用它'坚持'我的搜索参数,这为我的用户提供了他们搜索的历史状态,还允许他们为有用的搜索添加书签。最重要的是,当QA发现搜索缺陷时,他们可以直接链接到有问题的结果!)

Looking for a way to parse key pairs out of the hash/fragment of a URL into an object/associative array with JavaScript/JQuery

解决方案

Check out: jQuery BBQ

jQuery BBQ is designed for parsing things from the url (query string or fragment), and goes a bit farther to simplify fragment-based history. This is the jQuery plugin Yarin was looking for before he put together a pure js solution. Specifically, the deparam.fragment() function does the job. Have a look!

(The support site I'm working on uses an asynchronous search, and because BBQ makes it trivial to tuck entire objects into the fragment I use it to 'persist' my search parameters. This gives my users history states for their searches, and also allows them to bookmark useful searches. Best of all, when QA finds a search defect they can link straight to the problematic results!)

更多推荐

使用JavaScript解析URL哈希/片段标识符

本文发布于:2023-10-12 23:27:42,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标识符   片段   JavaScript   URL   哈希

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!