ocpaul20 Posted June 26, 2008 Share Posted June 26, 2008 I think this is a server issue but feel free to move it if you think it belongs somewhere else. I think I recall that servers are stateless which I assume means that each request and response is in effect as if it is 'the first' one ever received. If there are two tabs open pointing to the same web site, how does a browser know which tab gets the response from the server? If one server page takes longer than another, potentially, they could return to the client in reverse order. Is there some kind of sent code which says to the browser which request goes where? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 26, 2008 Share Posted June 26, 2008 This is all handled by the web browser itself. There is no HTTP protocol that exists which tells the browser how to load a page in a new window/tab. Quote Link to comment Share on other sites More sharing options...
ocpaul20 Posted June 26, 2008 Author Share Posted June 26, 2008 OK, so if I was writing a browser program, how would I match up the requests for pages from the server and the pages received. There has to be some way if the browser has two pages open from the same website being served from the same server. It is a basic browser function surely? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 27, 2008 Share Posted June 27, 2008 Maybe ask the dev folks at firefox, it is open source so you could just download the source code and have a browse through the code. As this is not related to Apache, I'll move this. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted June 27, 2008 Share Posted June 27, 2008 I think I recall that servers are stateless [...] That's just the HTTP protocol (and other protocols as well). There are protocols which have state such as IRC, FTP, SSH, BitTorrent and many others. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 27, 2008 Share Posted June 27, 2008 Short version - The port number determines which response matches which request. The HTTP request contains a port number (incremented for each request) that the request was made from. When the server sends the response back, it carries the port number of that request. To find out what happens if you have two tabs open in one browser, I recommend echoing the $_SERVER['REMOTE_PORT'] on your page. If the different tabs have wildly different series of port numbers, then it is probably using the port number. If they have the same series of port numbers, then something else either in the protocol or the headers is being used to identify where the response should go. Quote Link to comment Share on other sites More sharing options...
ocpaul20 Posted June 30, 2008 Author Share Posted June 30, 2008 I put it in apache because I thought it might have something to do with the server, but from the answers it seems that the server just gets the page and sends it back with the relevant information that was send from the client. Short version - The port number determines which response matches which request. Does this mean that if I save the IP number and the remote port number I can determine how many different tabs/instances of the browser have a page from my website opened? I guess it does then. Quote Link to comment Share on other sites More sharing options...
ocpaul20 Posted June 30, 2008 Author Share Posted June 30, 2008 I have done a quick investigation by displaying REMOTE_PORT on different pages loaded in different tabs, and sometimes they are the same and sometimes they change, so as you say, it seems to be using this somehow, but it may be not as simple as one tab = one port number. I have asked on the firefox forum and hopefully someone will be able to give a definitive answer. I would not know where to begin to look throught the source code of FF for this kind of thing. I will report back on this if I get any interesting information. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 30, 2008 Share Posted June 30, 2008 Been doing a big of research and it appears the technical term is called Tabbed Document Interface, have a read of that and see what you come up with. Quote Link to comment Share on other sites More sharing options...
ocpaul20 Posted June 30, 2008 Author Share Posted June 30, 2008 Thank you. I have read this and it is a useful description and background information on tabs in all their various forms.It also gives examples of various sorts and where they can be found, when they were originally used, etc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.