<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<!-- hash -->
<!-- <a href="#/hash">hash</a>
<a href="#/history">历史</a> -->
<a id="hash" href="/hash">hash</a>
<a id="history" href="/history">历史</a>
<div id="html"> </div>
<script>
//hash
// window.addEventListener('load',()=>{
// html.innerHTML = location.hash.slice(1);
// });
// window.addEventListener('hashchange',()=>{
// html.innerHTML = location.hash.slice(1)
// }); //history
function go(path) {
history.pushState({}, null, href);
html.innerHTML = href;
}
hash.onclick = function () {
let href = this.getAttribute('href');
go(href);
return false;
}
history.onclick = function () {
let href = this.getAttribute('href');
go(href);
return false;
}
window.addEventListener('popstate',()=>{
go(location.pathname);
}) </script>
</body>
</html>

最新文章

  1. delphi dev 汉化
  2. 桌面每日一句--桌面翻译工具(有道翻译,微软翻译,Google翻译)
  3. #Javascript:this用法整理
  4. js基础第七天
  5. Lucene索引的初步创建
  6. 【HDOJ】3587 NUDOTA
  7. ubuntu14.04 Markdown编辑器推荐之Remarkable
  8. htop安装步骤【原创】
  9. STM32+NRF24L01无线(转)
  10. CF518D. Ilya and Escalator [概率DP]
  11. AM335x关于LCD屏幕的时钟PLL配置
  12. 小程序开发--移动端分辨率与rpx
  13. springboot常见写法
  14. Awesome Tools
  15. collection管理程序中不同类别的资源
  16. Oracle错误——SP2-0734: 未知的命令开头 &quot;imp C##sin...&quot; - 忽略了剩余的行。
  17. mysql 5.7版本的下载安装
  18. SQL Server 学习博客分享列表(应用式学习 + 深入理解)
  19. ZOJ3435_Ideal Puzzle Bobble
  20. Contains,Exists,Any,Count 比较是否存在某个元素

热门文章

  1. 洛谷P2709 小B的询问 莫队
  2. torch.optim优化算法理解之optim.Adam()
  3. SpringMVC参数校验,包括JavaBean和基本类型的校验
  4. yii框架不输出头文件和尾文件
  5. POJ 2488 深搜dfs、
  6. [转]分布式session的几种实现方式
  7. VMware 注册码
  8. 清除SVN未版控文件
  9. H3C 路由表查找规则(1)
  10. H3C 配置路由器作为FTP客户端