基于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 基础篇4 window对象,DOM
Mar 14 Javascript
Jquery attr("checked") 返回checked或undefined 获取选中失效
Oct 10 Javascript
Jquery仿IGoogle实现可拖动窗口示例代码
Aug 22 Javascript
js实现仿百度风云榜可重复多次调用的TAB切换选项卡效果
Aug 31 Javascript
jQuery拖拽排序插件制作拖拽排序效果(附源码下载)
Feb 23 Javascript
BootstrapValidator超详细教程(推荐)
Dec 07 Javascript
wap手机端解决返回上一页的js实例
Dec 08 Javascript
react.js 父子组件数据绑定实时通讯的示例代码
Sep 25 Javascript
详解利用Angular实现多团队模块化SPA开发框架
Nov 27 Javascript
JS遍历JSON数组及获取JSON数组长度操作示例【测试可用】
Dec 12 Javascript
微信小程序实现蓝牙打印
Sep 23 Javascript
JavaScript图像放大镜效果实现方法详解
Jun 28 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
phpmail类发送邮件函数代码
2012/02/20 PHP
php数组转换js数组操作及json_encode的用法详解
2013/10/26 PHP
PHP URL参数获取方式的四种例子
2014/02/28 PHP
php中字符查找函数strpos、strrchr与strpbrk用法
2014/11/18 PHP
php获取Google机器人访问足迹的方法
2015/04/15 PHP
在IIS下安装PHP扩展的方法(超简单)
2017/04/10 PHP
Yii 2中的load()和save()示例详解
2017/08/03 PHP
js中几种去掉字串左右空格的方法
2006/12/25 Javascript
JQuery的Alert消息框插件使用介绍
2010/10/09 Javascript
使用js的replace()方法查找字符示例代码
2013/10/28 Javascript
Javascript调用函数方法的几种方式介绍
2015/03/20 Javascript
理解JavaScript中worker事件api
2015/12/25 Javascript
Web前端开发工具——bower依赖包管理工具
2016/03/29 Javascript
使用Nodejs连接mongodb数据库的实现代码
2017/08/21 NodeJs
利用Decorator如何控制Koa路由详解
2018/06/26 Javascript
详解JS深拷贝与浅拷贝
2020/08/04 Javascript
JavaScript实现网页动态生成表格
2020/11/25 Javascript
[02:58]献给西雅图的情书_高清
2014/05/29 DOTA
从零学Python之入门(五)缩进和选择
2014/05/27 Python
使用PyCharm配合部署Python的Django框架的配置纪实
2015/11/19 Python
python实现聊天小程序
2018/03/13 Python
TensorFlow 滑动平均的示例代码
2018/06/19 Python
HTML5 Canvas实现平移/放缩/旋转deom示例(附截图)
2013/07/04 HTML / CSS
Nike台湾官方商店:Nike.com (TW)
2017/08/16 全球购物
中国首家奢侈品O2O网购平台:第五大道奢侈品网
2017/12/14 全球购物
澳大利亚天然护肤品、化妆品和健康产品一站式商店:Nourished Life
2018/12/02 全球购物
英国花园、DIY、电器和家居用品商店:Robert Dyas
2019/03/18 全球购物
一些Solaris面试题
2015/12/22 面试题
某公司面试题
2012/03/05 面试题
大学生英语演讲稿
2014/04/24 职场文书
小学生环保演讲稿
2014/04/25 职场文书
舞蹈社团活动总结
2015/05/07 职场文书
关于童年的读书笔记
2015/06/26 职场文书
教师节主题班会方案
2015/08/17 职场文书
运动会广播稿300字
2015/08/19 职场文书
MySQL 8.0 之不可见列的基本操作
2021/05/20 MySQL