I need to render a very different page if the user has JavaScript than if they hadn’t.
No, you really don't do this. You need to make your page work without Javascript, but then improve it for those people who have Javascript enabled. There should be no reason to display a completely different page.
, , . - , Javascript, , script, . , , . , .