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?