javascripturlhtmlquora

How does Quora load two different webpages on the same URL


If you visit https://quora.com, but don't have a Quora account, you will see a login/sign up page. However, if you visit the same url. but do have an account, you will see your feed. What code does Quora use to show two different webpages on the same URL?


Solution

  • The account information is stored in the browser's cookies. When making a request to https://quora.com, the browser sends those cookies to the server. The server determinates based on the values in the cookies if the user is logged in or not.

    The answer to your question "What code does Quora use to show different versions of the same URL" cannot be inferred solely from the response, it could be anything that is run privately on their servers.

    You should check out how cookies work for instance here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies