1

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?

4

1 回答 1

1

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:

  • In the top right, click the Menu Chrome menu. Click Settings > Show advanced settings.
  • In the "Privacy" section, click Content settings.
  • Under "Cookies," click All cookies and site data.
  • To delete all cookies, click Remove all.
  • To delete a specific cookie, hover over a site, then click the that appears to the right.
  • You can also choose to remove all cookies created during a specific time period.

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

于 2016-04-16T16:38:42.963 回答