javascriptphpfacebookauthenticationdatabase-driven

How are users authenticated and customised pages served before a web page renders without javascript?


A good example of this is facebook's mobile view. This is not reliant on javascript and is able to authenticate the user with the server. If they are authenticated it will request and load your custom webpage, and if not you will see facebook's default home page.

How is all this accomplished without javascript and before the page renders? Is it PHP that runs before the DOM is rendered or is it another technology?


Solution

  • FB uses cookies to handle this. Before the page renders the cookie is sent to the server with the initial page load request, if the cookie is still valid you get past the login page, otherwise you need to login again.

    Here is how you can see what cookies you have in chrome:

    https://support.google.com/chrome/answer/95647?hl=en