Mozdevorg yuiblog

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: makes a request to the directory in which the page is located; Safari, Chrome, Firefox make a request to the actual page itself. This behavior could possibly corrupt user data, waste server compuOng cycles generaOng a page that will never be viewed, and in the worst case, cripple your servers by sending a large amount of unexpected traffic. •  Use GET for AJAX requests When using the XMLHlpRequest object, the browser implements POST in two steps: (1) send the headers, and (2) send the data. It is beler to use GET instead of POST since GET sends the headers and the data together (unless there are many cookies). IE's maximum URL length is 2 KB, so if you are sending more than this amount of data you may not be able to use GET. •  Reduce the number of DOM elements A complex page means more bytes to download, and it also means slower DOM access in JavaScript. Reduce the number of DOM elements on the page to improve performance. Copyright 2009 - 2013 Horowitz 33 Some New Rules (cont’d) •  Avoid HTTP 404 (Not Found) error Making an HTTP request and receiving a 404 (Not Found) error is expensive and degrades the user experience. Some sites have helpful 404 messages (for example, "Did you mean ...?"), which may assist the user, but server resources are sOll wasted. •  Reduce cookie size HTTP cookies are used for authenOcaOon, personalizaOon, and other purposes. Cookie informaOon is exchanged in the HTTP headers between web servers and the browser, so keeping the cookie size small minimizes the impact on response Ome. •  Use cookie- free domains When the brow...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online