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

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

寻找一种使用 JavaScript/JQuery 将 URL 的哈希/片段中的键对解析为对象/关联数组的方法

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

推荐答案

查看:jQuery BBQ

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

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!

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

(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:28:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1486192.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标识符   片段   JavaScript   URL   哈希

发布评论

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

>www.elefans.com

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