PDA

Click to See Complete Forum and Search --> : [RESOLVED] How is a web page processed?


mendhak
Apr 12th, 2006, 04:25 PM
This one isn't so much web development, so I post here.

In a web page, one may have something like this:

<script language="JavaScript" src="/js/NNN.js" />

At what stage in the execution of the page request is this file loaded? Logic would dictate that this JS file also be part of a request originating at the browser, and would constitute a separate GET request, aside from the GET being processed on the HTML page itself.

Can someone confirm/correct this?

The reason I am asking involves the creation of an HTTPHandler for IIS, the details of which I don't see necessary to get into at the moment. I can, if required.

mendhak
Apr 12th, 2006, 04:32 PM
PS: To get on my good side, you would confirm this behavior. :)

Inuyasha1782
Apr 12th, 2006, 05:53 PM
I would assume it created a second request because I'm preety sure the server never actually touches the insides of a file, it only returns it. So, when the request was first sent, the server would simply determine what type of file it is, make sure it's not something of a differrent language and needs to be parsed, check that the file is okay, and sends the contents back, not knowing that the actual file itself also needs another file. The only way for that to be possible would be that the server scans the file content first, for any requesting links like that, and returns the file, and any other requested file at the same time, but from my experience with packets I have never seen data recieved like that. Although I can't confirm that with documentation, it's preety self explanatory.

ducky
Apr 13th, 2006, 10:42 AM
I reviewed some of my web code that has this exact script/src tag. By viewing the web server log files you can clearly see it listed as a separate GET. However if multiple pages use the same script/src the entry does not always appear in the log file for a GET of the src code. This to me implies that the browser is doing the request on behalf of the script/src tag only when necessary since caching would come into play if its been requestd via another page already using it (script src). It seems to be treated the same as you would expect for images using img tags. One thing to note is that the the log time stamp is the same for the page and its contents that required GETs (script/src, img..).

penagate
Apr 13th, 2006, 11:23 AM
At what stage in the execution of the page request is this file loaded?

After the page is received and parsed, all external references are requested. If they are cached and the server returns "unchanged" the cached version is used, otherwise the request is continued.

You can monitor the behaviour in Firefox, using the LiveHttpHeaders (livehttpheaders.mozdev.org) extension.

mendhak
Apr 18th, 2006, 09:19 AM
After the page is received and parsed, all external references are requested. If they are cached and the server returns "unchanged" the cached version is used, otherwise the request is continued.

You can monitor the behaviour in Firefox, using the LiveHttpHeaders (livehttpheaders.mozdev.org) extension.
Thanks everyone, and this particular piece of information was helpful with something else I'm working on atm.