基于jQuery的history历史记录插件


Posted in Javascript onDecember 11, 2010

关于jQuery的历史
jQuery history plugin helps you to support back/forward buttons and bookmarks in your javascript applications.历史的jQuery插件可以帮助您回到您的JavaScript支持应用程序/前进按钮和书签。 You can store the application state into URL hash and restore the state from it.你可以存储到应用程序状态的网址散列和恢复它的状态。

Download jquery.history.js
下载jquery.history.js

jQuery history plugin is hosted on Github.
历史的jQuery插件托管在Github上。
Please visit the project page for development.
请访问项目页面进行开发。

Supported browsers支持的浏览器
Internet Explorer 6, 7, and 8+的Internet Explorer 6,7和8 +
Safari 4 and 5+的
Safari 4和5 +
Google Chrome 4+
谷歌浏览器4 +
This plugin is built on hashchange event , which is defined in HTML5 and supported in most modern browsers. Unless it is supported the plugin works on some fallback mechanisms:这个插件是在建hashchange事件 ,这是定义在浏览器支持HTML5和最现代化的机制。除非是支持一些后备插件工程:

monitoring location.hash by setInterval (Safari 4)
监测的setInterval location.hash(Safari 4中)
iframe and setInterval (IE 6, 7, and compatibility mode on IE8)
iframe的和setInterval(即6,IE8的第7和兼容模式)
Known issues
已知问题
IE6, 7, and IE8 compatibility mode
在IE6,7和IE8的兼容模式
Back/forward button will not work if you refresh the page and the document is reloaded.
后退/前进按钮将不会工作,如果你刷新页面,该文件重新加载。
IE8 standards mode
IE8的标准模式
The current hash will not be recorded in the history if you update the URL hash by hand or loading bookmarks.
目前哈希将不会被记录在历史上,如果你用手或加载更新书签网址哈希。

Demos
Some demos are available here and included in the repository.
And this site itself is built on the plugin:

(function($){ 
var origContent = ""; 
function loadContent(hash) { 
if(hash != "") { 
if(origContent == "") { 
origContent = $('#content').html(); 
} 
$('#content').load(hash +".html", 
function(){ prettyPrint(); }); 
} else if(origContent != "") { 
$('#content').html(origContent); 
} 
} 
$(document).ready(function() { 
$.history.init(loadContent); 
$('#navigation a').click(function(e) { 
var url = $(this).attr('href'); 
url = url.replace(/^.*#/, ''); 
$.history.load(url); 
return false; 
}); 
}); 
})(jQuery);

打包下载
Javascript 相关文章推荐
关于JavaScript的gzip静态压缩方法
Jan 05 Javascript
JS编程小常识很有用
Nov 26 Javascript
JavaScript异步编程Promise模式的6个特性
Apr 03 Javascript
使用js画图之饼图
Jan 12 Javascript
基于JavaScript实现轮播图代码
Jul 14 Javascript
JS判断iframe是否加载完成的方法
Aug 03 Javascript
JavaScript中清空数组的方法总结
Dec 02 Javascript
微信小程序 PHP后端form表单提交实例详解
Jan 12 Javascript
Bootstrap-table使用footerFormatter做统计列功能
Sep 07 Javascript
jquery.pager.js实现分页效果
Jul 29 jQuery
vue滚动插件better-scroll使用详解
Oct 18 Javascript
快速了解Vue父子组件传值以及父调子方法、子调父方法
Jul 15 Javascript
基于Jquery 解决Ajax请求的页面 浏览器后退前进功能,页面刷新功能实效问题
Dec 11 #Javascript
DIY jquery plugin - tabs标签切换实现代码
Dec 11 #Javascript
为超链接加上disabled后的故事
Dec 10 #Javascript
input按钮的事件处理大全
Dec 10 #Javascript
JavaScript(JS) 压缩 / 混淆 / 格式化 批处理工具
Dec 10 #Javascript
js下关于onmouseout、事件冒泡的问题经验小结
Dec 09 #Javascript
客户端限制只能上传jpg格式图片的js代码
Dec 09 #Javascript
You might like
基于PHP生成静态页的实现方法
2013/05/10 PHP
微信随机生成红包金额算法php版
2016/07/21 PHP
PHP/HTML混写的四种方式总结
2017/02/27 PHP
如何在centos8自定义目录安装php7.3
2019/11/28 PHP
NodeJS学习笔记之(Url,QueryString,Path)模块
2015/01/13 NodeJs
深入理解JavaScript中为什么string可以拥有方法
2016/05/24 Javascript
JS字符串false转boolean的方法(推荐)
2017/03/08 Javascript
BootStrap模态框和select2合用时input无法获取焦点的解决方法
2017/09/01 Javascript
nodejs结合socket.io实现websocket通信功能的方法
2018/01/12 NodeJs
JS实现的RC4加密算法示例
2018/08/16 Javascript
使用Node搭建reactSSR服务端渲染架构
2018/08/30 Javascript
开发用到的js封装方法(20种)
2018/10/12 Javascript
详解vue如何使用rules对表单字段进行校验
2018/10/17 Javascript
vue路由--网站导航功能详解
2019/03/29 Javascript
JS实现水平遍历和嵌套递归操作示例
2019/08/15 Javascript
Vue的click事件防抖和节流处理详解
2019/11/13 Javascript
JavaScript前端实现压缩图片功能
2020/03/06 Javascript
vue项目中使用bpmn-自定义platter的示例代码
2020/05/11 Javascript
微信小程序实现多图上传
2020/06/19 Javascript
Ant Design的可编辑Tree的实现操作
2020/10/31 Javascript
浅谈Ant Design Pro 菜单自定义 icon
2020/11/17 Javascript
react项目从新建到部署的实现示例
2021/02/19 Javascript
布同自制Python函数帮助查询小工具
2011/03/13 Python
Python实现合并同一个文件夹下所有PDF文件的方法示例
2018/04/28 Python
Python批处理更改文件名os.rename的方法
2018/10/26 Python
OpenCV图像颜色反转算法详解
2019/05/13 Python
python 通过可变参数计算n个数的乘积方法
2019/06/13 Python
python实现将视频按帧读取到自定义目录
2019/12/10 Python
python用Tkinter做自己的中文代码编辑器
2020/09/07 Python
房地产销售计划书
2014/01/10 职场文书
中学生校园广播稿
2014/01/16 职场文书
幼儿园教师工作感言
2014/02/15 职场文书
幼儿教师自我剖析材料
2014/09/29 职场文书
2014年仓库工作总结
2014/11/20 职场文书
优秀少先队辅导员事迹材料
2014/12/24 职场文书
小学总务工作总结
2015/08/13 职场文书