Getting Started - Chapter 1 - Enhancing Your Website

First Model on a Web Page.

Provided the file type is one recognized by Babylon.js then you can use the Babylon.js Viewer to display your scene or model on a web page using the <babylon> element. Examples of suitable file types are .babylon, .gltf and glb with .glb recommended. It makes no difference whether the scene was built with Babylon.js or created with your favorite design software. The <babylon> element will be sized to fit its container.

In order to use the Viewer you need to add its code to your HTML page in a <script> element

<script src="https://cdn.babylonjs.com/viewer/babylon.viewer.js"></script>

Once this is added you place the <babylon> element in an appropriate container and points its model attribute to the file source.

<babylon model="Path to File"></babylon>

Example Web Page

Page 1

When you want to use your models for a game or application on a web page you need first to know how to import them.