html标签
<section></section>
<header></header>
<footer></footer>
<nav></nav>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
html中的转义:< < > > 空格
H5API
开起全屏显示
Element.requestFullscreen()
关闭全屏显示
Element.cancelFullScreen()
添加私有前缀
要加私有前缀(-webkit- -moz- -ms- -0-)
Element.webkitRequestFullscreen()
页面文档全屏
document.documentElement.webkitRequestFullscreen()
取消全屏
document.webkit CancelFullScreen()
本地存储
只能存储字符串,可以将对象JSON.stringify()编码后存储
sessionStorage
约5M容量 window.sessionStorage 生命周期为关闭浏览器窗口,在同一个窗口(页面)下数据可以共享
setItem(key,value) //设置存储内容
getItem(key) //读取内容
removeItem(key) //删除键值为key的存储内容
clear() //清空所有存储内容
localStorage
约20M容量 window.localStorage 永久生效,除非手动删除(服务器方式访问然后清楚缓存),可以多窗口(页面)共享
localStorage.setItem(key,value) //保存数据
localStorage.getItem(key) //读取数据
localStorage.removeItem(key) //删除单个数据
localStorage.clear() //删除所有数据
localStorage.key(index) //得到某个索引的key
cookie
cookie个数小于20个,总大小 小于4KB 一般由服务器生成,可设置失效时间。如果在浏览器端生成Cookie,默认是关闭浏览器后失效 每次都会携带在HTTP头中,如果使用cookie保存过多数据会带来性能问题