HTML and CSS Reference
In-Depth Information
Figure E.2. The results of reloading the simple dynamic page in Firefox and Chrome
You may be scratching your head at this result—we certainly did. Chrome's Network tab in
its developer tools shows only a single request, so why does the variable get incremented
twice? The answer is that Chrome makes an additional request that it doesn't tell you about
for favicon.ico . In case you're not familiar with it, favicon.ico is the standard
name for the little icon that appears alongside the URL in the address bar. Because your
Node server is configured to respond to every request with the same HTML file, it sends
that file in response to the request for favicon.ico , too. This results in the variable be-
ing incremented twice.
To stop this from happening, you need a way to route requests for different URLs to differ-
ent server responses. This is called routing and will be the subject of the next section.
 
Search WWH ::




Custom Search