web
文章平均质量分 60
李亞飛
这个作者很懒,什么都没留下…
展开
-
Cookie和会话状态的工作原理及Cookie欺骗
<br />session是一种保存上下文信息的机制,它是针对每一个用户的,变量的值保存在服务器端,通过SessionID来区分不同的客户,session是以Cookie或URL重写为基础。默认使用Cookie来实现,系统会创造一个名为JSESSIONID的输出Cookie,或称为"Session Cookie",以区别Persistent Cookies(通常所说的Cookie).Session Cookie是存储在浏览器中,并不是写在硬盘上的,但是把浏览器的Cookie禁止后,使用response对象的转载 2011-01-19 12:59:00 · 397 阅读 · 0 评论 -
pagespeed 摘要 - Minimize payload size
Enable compressionNote that gzipping is only beneficial for larger resources. Due to the overhead and latency of compression and decompression, you should only gzip files above acertain size thresho原创 2012-08-09 17:07:29 · 2139 阅读 · 0 评论 -
pagespeed 摘要 - Minimize round-trip times
Minimize DNS lookupsThe optimal number is somewhere between 1 and 5hosts (1 main host plus 4 hosts on which to parallelize cacheable resources). As a rule of thumb, you shouldn't use more than 1 h原创 2012-08-09 16:49:39 · 729 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-10.Tools
JavaScript Profilingvar Timer = {_data: {},start: function(key) {Timer._data[key] = new Date();},stop: function(key) {var time = Timer._data[key];if (time) {Timer._data[key] = new Da原创 2012-08-09 14:54:16 · 697 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-8.Programming Practices
• Avoid the double evaluation penalty by avoiding the use of eval() and theFunction() constructor. Also, pass functions into setTimeout() and setInterval() instead of strings.• Use object and arra原创 2012-08-09 14:46:25 · 407 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-3.DOM Scripting
HTML collections are array-like objects containing DOM node references. • document.getElementsByName()• document.getElementsByClassName()• document.getElementsByTagName()• document.images• d原创 2012-08-09 11:38:08 · 543 阅读 · 0 评论 -
pagespeed 摘要 - Optimize browser rendering
Use efficient CSS selectors1.Avoid a universal key selector.2.Make your rules as specific as possible.3.Remove redundant qualifiers.4.Avoid using descendant selectors, especially those t原创 2012-08-09 17:15:25 · 1945 阅读 · 0 评论 -
pagespeed 摘要 - Minimize request overhead
Minimize request size1500 bytes 1.Use server-side storage for most of the cookie payload.2.Remove unused or duplicated cookie fields. cookie应小于400bytes Serve static content from a cookie原创 2012-08-09 16:54:42 · 2288 阅读 · 0 评论 -
pagespeed 摘要 - Optimize caching
Leverage browser caching1.Set caching headers aggressively for all static resources.Set Expires to a minimum of one month, and preferably up to one year, in the future. (We prefer Expires over C原创 2012-08-09 16:26:45 · 475 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-1.Loading and Execution
标签会阻塞页面的解析过程,新的浏览器已经充许标签之间可以并行下载,但仍然会阻塞其它资源的下载 Nonblocking Scripts 1.Deferred Scriptsdefer>ie支持。一个带有defer属性的标签可以放置在文档的任何位置。对应的JavaScript 文件将在被解析时启动下载,但代码不会被执行,直到DOM加载完成(在onload 事件句柄被调用原创 2012-08-09 10:00:20 · 683 阅读 · 0 评论 -
JavaScript Performance Rocks
原创 2012-08-09 17:26:41 · 2286 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-7.Ajax
Data TransmissionRequesting DataThere are five general techniques for requesting data from a server:• XMLHttpRequest (XHR)var url = '/data.php';var params = ['id=934875','limit=20'];原创 2012-08-09 14:37:10 · 484 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-6.Responsive Interfaces
Browser LimitsCallstack size limitLong-running script limit 100ms Yielding with Timersvar button =document.getElementById("my-button");button.onclick =function(){ oneMethod(); set原创 2012-08-09 14:16:37 · 502 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-5.Strings and Regular Expressions
//跨浏览器,性能稳定if (!String.prototype.trim) {String.prototype.trim = function() {return this.replace(/^\s+/,"").replace(/\s+$/, "");}} // 长字符串操作时变慢String.prototype.trim = function() {retu原创 2012-08-09 14:05:20 · 577 阅读 · 0 评论 -
<<High Performance JavaScript>>读书笔记-2.Data Access
Scope Chains and Identifier Resolutionfunction add(num1, num2){ var sum = num1 + num2; return sum;}Scope Chain Augmentationwith表达式会临时改变execution context中的Scope chain,一个新的包含原创 2012-08-09 11:05:56 · 518 阅读 · 0 评论 -
js 版 tail -f
#!/usr/local/bin/nodevar fs = require('fs');if(process.argv.length < 3){ console.log('usage: ./watch.js filename'); process.exit(0);}fs.watchFile(process.argv[2],function(curr,prev){原创 2012-08-06 10:13:34 · 975 阅读 · 0 评论 -
Cookie基础知识
<br />一、什么是Cookie<br />Cookie是当你浏览某网站时,网站存储在你机器上的一个小文本文件,它记录了你的用户ID,密码、浏览过的网页、停留的时间等信息,当你再次来到该网站时,网站通过读取Cookie,得知你的相关信息,就可以做出相应的动作,如在页面显示欢迎你的标语,或者让你不用输入ID、密码就直接登录等等。你可以在IE的“工具/Internet选项”的“常规”选项卡中,选择“设置/查看文件”,查看所有保存到你电脑里的Cookie。这些文件通常是以user@domain格式命名的,如lo原创 2011-02-24 10:22:00 · 763 阅读 · 0 评论 -
V8 and Javascript gotchas
Gotcha #1: this keywordGotcha #2: variable scope and variable evaluation strategy Object properties are not iterated in order (V8) Comparing NaN with anything (even NaN) is always fa原创 2012-08-09 21:23:44 · 2295 阅读 · 0 评论