flash service

High_Performance_Web_Sites

Issue link: https://read.uberflip.com/i/1146286

Contents of this Issue

Navigation

Page 99 of 169

78 | Chapter 11: Rule 11: Avoid Redirects In Chapter 5, I talk about the importance of downloading stylesheets quickly; other- wise, the page is blocked from rendering. Similarly, Chapter 6 explains how external scripts block the page from rendering and inhibit parallel downloads. The delays caused by redirects are even worse because they delay the delivery of the entire HTML document. Nothing in the page can be rendered and no components can be downloaded until the HTML document has arrived. Inserting a redirect between the user and the HTML document delays everything in the page. Redirects are typically used with requests for the HTML document, but occasionally you'll see them used for components in the page. Figure 11-2 shows the HTTP requests for Google Toolbar. It contains four redirects. The sequence of requests and redirects is complex, so I'll walk through them one at a time: 1. The initial URL http://toolbar.google.com is requested. 2. A 302 response is received with a Location of http://toolbar.google.com/T4. 3. http://toolbar.google.com/T4/ is requested. 4. This HTML document redirects the user to http://www.google.com/tools/firefox/ toolbar/index.html using JavaScript. 5. The JavaScript redirect results in a 302 response with the Location http://www. google.com/tools/firefox/toolbar/FT3/intl/en/index.html. At this point there have been a total of three redirects—one done with JavaScript and two using the 302 status code. 6. Six images are downloaded. 7. A seventh image is requested at http://toolbar.google.com/T3/intl/search.gif. Figure 11-2. Multiple redirects including an image redirect html script stylesheet stylesheet stylesheet image image image image image redirect image image image 1 2 3 4 5 6 7 8 9

Articles in this issue

Links on this page

Archives of this issue

view archives of flash service - High_Performance_Web_Sites