This is a basic example of working with VR on the web using Three.js.
You will need to have Node.js installed.
Then type the following in a terminal:
npm install
npm run start
Then open http://localhost:1234 in a WebXR capable browser. If you are using Chrome or Firefox on a desktop you will first need to install a WebXR emulator (for Chrome, for Firefox). Bring up the developer tools, select the WebXR tab and make sure a VR headset is selected in the drop-down on the left.