# Not able to load "gltf" asset on chrome latest browser

**URL:** <https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581>\
**Category:** Questions\
**Tags:** gltf, babylon, gltffileloader, scene\
**Created:** [December 15, 2022, 2:52pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581 "2022-12-15T14:52:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 15, 2022, 2:52pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/1 "2022-12-15T14:52:21Z")

</div>

Not able to load **`.gltf`** on my browser, please help me

**Error**

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/0/50ceb53222be9cb12154244c5c038771153ecfce.png)

Sorry for sharing code instead of playground, I don’t know how to upload asset to a playground

**Code**

```auto
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <title>Babylon.js sample code</title>

        <!-- Babylon.js -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
        <script src="https://assets.babylonjs.com/generated/Assets.js"></script>
        <script src="https://preview.babylonjs.com/ammo.js"></script>
        <script src="https://preview.babylonjs.com/cannon.js"></script>
        <script src="https://preview.babylonjs.com/Oimo.js"></script>
        <script src="https://preview.babylonjs.com/earcut.min.js"></script>
        <script src="https://preview.babylonjs.com/babylon.js"></script>
        <script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
        <script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
        <script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
        <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script>
        <script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>
        <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>
        <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>

        <style>
            html, body {
                overflow: hidden;
                width: 100%;
                height: 100%;
                margin: 0;
                padding: 0;
            }

            #renderCanvas {
                width: 100%;
                height: 100%;
                touch-action: none;
            }
        </style>
    </head>
<body>
    <canvas id="renderCanvas"></canvas>
    <script>
        var canvas = document.getElementById("renderCanvas");

        var startRenderLoop = function (engine, canvas) {
            engine.runRenderLoop(function () {
                if (sceneToRender && sceneToRender.activeCamera) {
                    sceneToRender.render();
                }
            });
        }

        var engine = null;
        var scene = null;
        var sceneToRender = null;
        var createDefaultEngine = function() { return new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true, disableWebGL2Support: false}); };
        var delayCreateScene = function () {
    var scene = new BABYLON.Scene(engine);

    BABYLON.SceneLoader.Append("assets/", "simple_3d.gltf", scene, function (scene) {
        scene.createDefaultCameraOrLight(true, true, true);
        scene.activeCamera.alpha += Math.PI;
    });

    return scene;
};
                window.initFunction = async function() {
                    
                    
                    var asyncEngineCreation = async function() {
                        try {
                        return createDefaultEngine();
                        } catch(e) {
                        console.log("the available createEngine function failed. Creating the default engine instead");
                        return createDefaultEngine();
                        }
                    }

                    window.engine = await asyncEngineCreation();
        if (!engine) throw 'engine should not be null.';
        startRenderLoop(engine, canvas);
        window.scene = delayCreateScene();};
        initFunction().then(() => {sceneToRender = scene                    
        });

        // Resize
        window.addEventListener("resize", function () {
            engine.resize();
        });
    </script>
</body>
</html>

```

* * *

* * *

* * *

**After Edit**  
Considering suggestion given by @RaananW I tried using web-server to serve file requests, but still I’m facing same issue

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/b/1b7fb066f7c9a460da1a116097fb43bf3b557b0b.png)

I’ve also tried another approach, I uploaded asset to my **github** repo and used that URL for loading but got weird error

**code**

```auto
    BABYLON.SceneLoader.Append("https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/ABeautifulGame/glTF/", "ABeautifulGame.gltf", scene, function (scene) {
        scene.createDefaultCameraOrLight(true, true, true);
        scene.activeCamera.alpha += Math.PI;
    });

```

* * *

In this case fetch was successful - I checked network tab

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/e/9e042be4d71c41bdf1b1d7b8c412ae69c0b962e0.png)

* * *

But in console I’m seeing this error

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/7/37c6a174d96c99b359da3b248dc839cc66f9e668.png)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 15, 2022, 3:36pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/2 "2022-12-15T15:36:21Z")

</div>

Asking a question with no context won’t allow us to help. The file is probably not hosted on your sever, but just pasting code and a screenshot of the error log won’t get you very far, sorry.

P.S. - I hope I can ask that - is this really your name?

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 15, 2022, 5:06pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/3 "2022-12-15T17:06:06Z")

</div>

My apologise if I’ve not followed best practices of asking question.

Basically what I’am trying to do is for some hackathon event I’ve planned to integrated Babylon.js with e-commerce store to render 3d Objects with bit of AR, if this works well we might even include this with our platform

To get started with this I’ve just downloaded code from one of playgrounds mentioned in the docs and tried running it, but got above error, before asking questions I’ve tried lot of things like importing `gitlfloader`  
`<script src="babylon.glTFFileLoader.js"></script>`, tried with different browsers and versions but none of them helped. So came here for help 🙂

Also `Swastik` is my real name in India it is used as symbol of luck (which I don’t have 😅)

**Stack trace** - Hope I won’t disappoint you again by attaching scrrenshot

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/c/fcb1f30d1d9c974b3ee37ce6c91186e78eb14fd0.png)

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [December 15, 2022, 5:57pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/4 "2022-12-15T17:57:41Z")

</div>

The file path is not correct and your model does not exist in the given path

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 15, 2022, 6:23pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/5 "2022-12-15T18:23:17Z")

</div>

I don’t think so, my folder structure is very simple as below

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/4/74711cc4902622a47fcdb815fc71fb52d8b84f38.png)

Also I get below error when I give absolute path

```auto
    BABYLON.SceneLoader.Append("/Users/swastikn/Downloads/sample-ar/assets/", "simple_3d.gltf", scene, function (scene) {
        scene.createDefaultCameraOrLight(true, true, true);
        scene.activeCamera.alpha += Math.PI;
    });

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/6/e6180bb65524951814d3df067a357e2f1d29f136.png)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 15, 2022, 6:33pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/6 "2022-12-15T18:33:54Z")

</div>

Are you hosting the files using a web server, or just opening the index file?

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 15, 2022, 6:36pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/7 "2022-12-15T18:36:43Z")

</div>

Just opening index file (test.html)

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 15, 2022, 6:38pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/8 "2022-12-15T18:38:12Z")

</div>

By using live server plugin, it gives an option as “open with live server”

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 15, 2022, 6:38pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/9 "2022-12-15T18:38:58Z")

</div>

you have to serve the files using a web server if you want to use the http protocol. Your file system will not suffice.

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 15, 2022, 6:40pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/10 "2022-12-15T18:40:30Z")

</div>

I just want to load them from my local without any web server and http, how can I do that ?

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 15, 2022, 6:42pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/11 "2022-12-15T18:42:09Z")

</div>

Last time when I had used babylonjs with 4.X version it used to work, at least in other functions where I used to load my game objects and sound related assets

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 15, 2022, 7:27pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/12 "2022-12-15T19:27:06Z")

</div>

i’m not sure what changed between the two versions, but if you want to load a file using http (which you are doing here) you need to get the right response from the server you are requesting the file from.  
You can try using the file protocol instead, but most browsers block it, at least without the right permissions. You can also encode the file to base64 and load it using a data URL, but that’s a whole different story.  
Just run a local web server. it’s as easy as writing `npx http-server` in the directory you are trying to host.

---

<div class="post-metadata">

**Author:** ![jeremy-coleman](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jeremy-coleman/32/15493_2.png) [@jeremy-coleman](https://forum.babylonjs.com/u/jeremy-coleman)\
**Post date:** [December 15, 2022, 10:58pm UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/13 "2022-12-15T22:58:59Z")

</div>

The live server he mentioned is a web server, its a vscode thing.

For the absolute paths, most node servers these days wont serve above the cwd for security reasons. Otherwise, any website or even a random ad inside an iframe could probe for stuff on your fs. You may need to prepend a slash to the root path. You could also use window.location to create the full path at runtime

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2022, 4:31am UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/14 "2022-12-16T04:31:23Z")

</div>

> [@RaananW](#):
>
> `npx http-server`

with this also, I’m getting same error. I just want to load asset from my local folder, not sure why that function implementation is making http call for that. Sorry I’ve no clue what I’m doing wrong here

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2022, 4:36am UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/15 "2022-12-16T04:36:34Z")

</div>

> [@jeremy-coleman](#):
>
> You may need to prepend a slash to the root path

like this?

```auto
var path = "//Users/swastikn/Downloads/sample-ar/assets/"
BABYLON.SceneLoader.Append(path, "simple_3d.gltf", .....

```

Also I didn’t get how `window.location` would help here

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2022, 4:40am UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/16 "2022-12-16T04:40:36Z")

</div>

I think I should try with my own server, like using `express js`. To avoid all these mess

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2022, 9:22am UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/17 "2022-12-16T09:22:04Z")

</div>

Have updated the question with what I’ve tried please check @jeremy-coleman @RaananW @Dad72

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 16, 2022, 11:06am UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/18 "2022-12-16T11:06:30Z")

</div>

did you load the index file using localhost:8080, or did you load it again using the index.html as a file in the browser?

---

<div class="post-metadata">

**Author:** ![Swastik\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/swastik_k/32/20550_2.png) [@Swastik\_K](https://forum.babylonjs.com/u/Swastik_K)\
**Post date:** [December 16, 2022, 11:40am UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/19 "2022-12-16T11:40:48Z")

</div>

So how I’m doing is, I’m running `http-server` command on my project directory, and then navigating to endpoint provided by `http-server` ([http://127.0.0.1:8081](http://127.0.0.1:8081)) and then changing path to `http://127.0.0.1:8081/test.html`. At this point `test.html` will call

> `BABYLON.SceneLoader.Append("http://127.0.0.1:8081/", "simple_3d.gltf", scene, function (scene) {`

But here when I check network tab 3d model is fetched successfully but getting same error on console

## **Successfully loaded 3d file**![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/3/33047eabc3d7f6cb0304cb2e02fd873fd2a22ee3.jpeg)

**Error on console**

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/8/f878b9574e3648453bfcc27d4fc48d7b4ee577e6.png)

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [December 16, 2022, 11:53am UTC](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581/20 "2022-12-16T11:53:16Z")

</div>

wasn’t the file in the assets directory? Are you sure the file is really served using the server? what is the result in the preview tab? Doesn’t the glTF require other files? images for the textures?

Look, something is wrong somewhere. You need to check if the file is opened in the browser (downloaded when you use the URL, for example).  
I also wonder what this “OK” message you are getting - there is no reason to return “OK” as string, and I don’t believe we have this return code in the framework. This is something you will have to debug on your own. We can continue back and forth, but this is a local issue - either the html file or the glTF has an issue here.  
We love helping debugging projects. if you want to share the entire project on github I am sure we will be more able to help.

[Next page](https://forum.babylonjs.com/t/not-able-to-load-gltf-asset-on-chrome-latest-browser/36581.md?page=2)
