Now that you've created an awesome virtual reality world in the CodeHS editor, it's time to load that world up in a smartphone VR viewer such as the Google Cardboard. This article gives you the steps to do just that.

Note: There is a playlist describing how to do this, including a video walkthrough, here: codehs.com/playlist/2193

1. Open up the VR world on a smartphone

The world you've created is simply a webpage that lives at a specific URL on the Internet. To open it up on a smartphone, all we have to do is visit this URL on the smartphone's browser (Chrome or Safari work best). There are a few ways to do this:

  • Use the QR Code for your world by going to the More tab and choosing "Run on Phone"

Scanning this QR code from any QR code scanner will open the website in the mobile browser. We recommend using either Expo or Chrome to scan the QR code. Expo is an app available free for iOS or Android, and has an easy-to-access Scan QR Code option.

The QR code can also be scanned with the Google Chrome app. To scan with Chrome on an iPhone, you just need to force press the Chrome app icon, and the menu shown below will appear. Then select the Scan QR Code option.

Now you should see your VR world loaded in your mobile browser! This is the easiest way to load the URL in a mobile browser. To do this without a QR scanner:

  • Alternative: Copy the URL and send it to your phone

You can get the URL for your VR world directly by choosing "See HTML in new window" under the Run Code button.

This will open up your world in a new window. Your browser may block this window pop up, in which case you'll need to allow pop ups:

Now you should see your world in a new window. The URL for the world is in the window:

Copy this URL and send it to your phone either over email or text. Alternatively, you can manually type out the URL in your phone's browser.
Open this URL in your phone's browser (Chrome or Safari work best) and you should see your Virtual Reality creation loaded on your phone!

2. Press the VR Goggle Button

Pressing the VR Goggle Button switches the world from 2D view into VR view:

Once you've pressed the button you should be prompted to turn your phone sideways and insert it into a cardboard holder:

Once you turn your phone sideways the world will be displayed as two separate images, one for each eye:

3. Insert your phone into the cardboard holder

Simply insert your sideways phone into the cardboard holder (or similar VR viewing device) and see your VR creation in actual virtual reality!

Did this answer your question?