本站实验: Local Storage

本站已经在尝试使用LocalStorage作缓存。

感谢qgy18的网站内容给我的启发。

本站的实现比较简陋而且偏客户端,失败率可能较高。

https:// 以try函数尝试,如果是IE等无LocalStorage浏览器,第一行代码便会出错,直接跳转到下面输出完整JS。
try {
    https:// 定义存取函数
	var l2js = function(b) {
			var a = document.createElement("script");
			a.innerHTML = window.localStorage[b];
			document.head.appendChild(a)
		},
		l2css = function(b) {
			var a = document.createElement("style");
			a.innerHTML = window.localStorage[b];
			document.head.appendChild(a)
		},
		h2l = function(b, a) {
			window.localStorage[b] = a
		},
		dls = function(a){
			window.localStorage.removeItem(a)
		};
	https:// 判断LS内容是否存在、版本号是否符合,如其中一项有差,就完整输出并存入,以修正错误
	https:// CSS
	window.localStorage.css &&(window.localStorage.css_v = "02") ? l2css("css") : document.write('<script src="https://cdn.qtxh.net/assets/js/style.02.js?v=a3186467fb">\x3c/script>');
	https:// jQuery
	window.localStorage.jq && (window.localStorage.jq_v = "2.2.4") ? l2js("jq") : document.write('<script src="https://cdn.qtxh.net/assets/js/jquery.01.js?v=a3186467fb">\x3c/script>');
	https:// 自带脚本
	localStorage.js && (window.localStorage.js_v = "01") ? l2js("js") : document.write('<script src="https://cdn.qtxh.net/assets/js/script.01.js?v=a3186467fb">\x3c/script>');
	https:// 页脚信息
	window.localStorage.footer && (window.localStorage.footer_v = "05") ? l2js("footer") : document.write('<script src="https://cdn.qtxh.net/assets/js/footer.05.js?v=a3186467fb">\x3c/script>')
} catch (e) {
	https:// IE等浏览器因为上面定义存取函数时就会出错,跳转到这里,全量输出
	document.write('<script src="https://cdn.qtxh.net/assets/js/try.01.js?v=a3186467fb">\x3c/script>')
}