I know little about networking the Internet, but, from what I understand, it works — very approximately — as follows:

  • I, sitting at the computer example.com, send a message saying, roughly, "get http://s.tk" to my ISP, which passes the message along, eventually to the machine at s.tk.
  • The s.tk machine gets "example.com has sent 'get http://s.tk'", so sends somefile to its ISP which passes the file along, eventually to the machine at example.com.

When the file gets back to example.com, my computer, how does my computer know what to do with it? I'm sure the headers (or something else) indicate it's a Web page rather than, say, a Usenet post — that's not my question. My question is: how does my computer know whether to display the received Web page in my open Opera window or my open Firefox window, or my other open Firefox window, or, heck, to open a new browser instance?

  • @ChrisS, your point 2 I cannot disagree with, and if this is off-topic then I'll grant it should be closed. (Is there a SE site where this is on-topic?) But too broad? I asked a very specific question: how the computer knows which browser window should display the received Web page. – msh210 Jun 26 '13 at 4:17
  • (And re your point 2, @ChrisS, some SE sites imply they're for professionals but actually welcome on-point questions from newbies, too. I gather that SF isn't such.) – msh210 Jun 26 '13 at 4:51
  • Note that none of the answers at superuser.com/q/31468 address this question. – msh210 Jun 26 '13 at 5:11

The decision how to render an object is done based on:

  • HTTP header Content-type
  • file extension (if the above is missing)
  • file signature, if the browser is supporting this
  • a default action (like download and try to use the OS to open the file.

The heuristic how to render is browser dependent. Some browser extension will change the behavior for certain file or MIME types.

To understand how a page is processes by a certain browser window and not a different one, you should start by reading about the OSI model. In short each TCP connection is assigned by the kernel to a program, like a browser. The browser is keeping tab state and the details of which HTML element is part of which tab.

  • I specifically said in the question that I'm not asking how the computer knows whether the received file is a Web page or a Usenet post. That covers your four bullet points. Now am I asking how to render, which is what you address last. Please reread the question, which asks specifically how the computer knows which browser window to send the Web page to. – msh210 Jun 26 '13 at 4:15
  • @msh210: "how the computer knows which browser window to send the web page to" - Don't you know which browser window you requested that web page from? How is this connection so difficult to make? – Karan Jun 28 '13 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.