Guide to importing a glTF scene into your three.js project while using Internet Explorer 11

After successfully implementing a simple html code to load a gltf model using three.js and their gltfloader.js, I encountered an issue where it works flawlessly on Mozilla but fails to display on ie11 without any errors being thrown. Despite trying the es6-promise polyfill, the problem persists. My goal is to make it work on internet explorer. Here is the code snippet below, mostly derived from an example code.

<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>My first three.js app</title>
        <style>
            body { margin: 0; }
            canvas { width: 100%; height: 100% }
        </style>
    </head>
    <body>
        <script src="js/three.js"></script>
        <script src="js/GLTFLoader.js"></script>
        <script src="js/OrbitControl.js"></script>
        <script src="js/es6-promise.min.js"></script>
        <script src="js/es6-promise.js"></script>
        <script src="js/es6-promise.auto.js"></script>      

        <script>
            var scene = new THREE.Scene();
            var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );
            var controls = new THREE.OrbitControls( camera );
            var renderer = new THREE.WebGLRenderer();
            renderer.setSize( window.innerWidth, window.innerHeight );
            document.body.appendChild( renderer.domElement );
            controls.screenSpacePanning = true;

            
            // Other code snippets...
            
            animate();
        </script>
    </body>
</html>

EDIT: Note that the box displayed correctly, indicating that the issue lies specifically with loading the gltf model in ie11.

EDIT 2: I also noticed that the gltf loader example provided by three.js does not function on ie11 as well. This prompts the question of whether the loader itself is incompatible with ie11.

Answer №1

Here is the solution I came up with:

  1. Add ES6 support polyfill in your HTML code

    <script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script>

  2. If the gltf model is still not showing on your page, try making this change: modify the parse function in GLTFLoader.js

    var json = JSON.parse(content)

    to

    var json = JSON.parse(content.trim())

    My browser: Internet Explorer 11.0.9600.17843IS

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A TypeScript class transferring data to a different class

I have a set of class values that I need to store in another class. function retainValues(data1,data2){ this.first = data1; this.second = data2; } I am looking for a way to save these class values in a different class like this -> let other = N ...

Update the URL once a form has been successfully submitted using AJAX with a GET request

I am trying to update the current URL after submitting a form using an AJAX GET request. Previously, I attempted to utilize history.pushState(null, null, url+'?'+form.serialize()) and it did work fine. However, the issue arises where only a port ...

The process of loading and saving extensive data to the local storage of a user's Firefox browser involves extensive reading and writing operations

Our team has developed a sophisticated HTML5 offline application that houses a substantial amount of data, totaling tens of megabytes. We are looking for a way to allow users to save and retrieve copies of this data on their disk. While we have made some ...

What is the method for invoking an express middleware function that triggers a file download?

Currently, I am delving into Express and experimenting with middleware. My goal is to initiate a file download when accessing the root route while sending out a "Hello World" message. My attempts so far have been: function initiateDownload(req, res, next) ...

What is the best way to populate nested elements with jQuery?

I am trying to showcase the latest NEWS headlines on my website by populating them using Jquery. Despite writing the necessary code, I am facing an issue where nothing appears on the webpage. Below is the HTML code snippet: <div class="col-md-4"> ...

Mobile Mode Issue with Bootstrap 4 Navbar Example

Currently, I am exploring the Bootstrap material and trying to understand how to integrate their content with a jinja2 file that I am preparing for a django project. Upon attempting to copy and paste their example code (specifically this example http://get ...

How to Create a Speech Bubble in SVG Using SnapSVG

In the process of developing a chat program, I have animated figures moving across the screen engaging in conversations. One crucial aspect I am yet to implement is creating scalable speech bubbles for when users interact. Being relatively new to SVG and ...

Developing a matrix arithmetic parser using JavaScript

Currently, I am in the process of developing a program that can solve matrix equations. My main focus right now is on making sure the parser functions correctly. However, I am feeling lost and unsure of where to begin. In my program, I utilize an array of ...

Plotting only the initial and final point on Google Maps using API

I am currently working on a tracking application that utilizes the Geolocation and Google Maps API. The app is set up to track the user's position using the watchPosition() function. As of now, a new blue icon is displayed every time a new longitude a ...

Move the object by clicking on it and dragging

I need help figuring out how to move my 3D object in .gltf format to a different position when a checkbox is checked, and then back to its original position when the checkbox is unchecked. I attempted to create a transition function for this purpose, but t ...

Converting EDN data to a string and back in Clojure/ClojureScript

When working with JavaScript, one can convert a JavaScript data structure into a JSON string using the following code: JSON.stringify({somedata: { somesubdata: {}}}) Then, to parse it back into a JS data structure, you can use: var my_obj = JSON.parse(" ...

Ways to avoid the occurrence of light banding problem in EffectsComposer

I am encountering an issue with the light quality in my scene when using a composer. While everything looks fine with the standard renderer, the light becomes banded when I add a bloompass with 0.001 strength. The same issue occurs with other passes like L ...

Converting constants into JavaScript code

I've been diving into typescript recently and came across a simple code snippet that defines a constant variable and logs it to the console. const versionNuber : number = 1.3; console.log(versionNuber); Upon running the tsc command on the file, I no ...

The absence of variable declaration in a 'for...of' loop is functional in .js files but does not work in

index.js let items = [{ item: 'apple' }, { item: 'banana' }, { item: 'orange' }]; for (item of items) { console.log(item); } Execute using node $ node index.js { item: 'apple' } { item: 'banana' } { ...

Utilizing Jquery or Javascript to Establish a Fresh Perspective for CylinderGeometry with Three.js

I'm attempting to change the dimensions of a cylinder created using examples from Three.js at runtime, but my code doesn't seem to be working. Here is the code snippet I am using: HTML <script src="http://www.html5canvastutorials.com/librari ...

Tips for validating the input type "password"

Below is the Jquery Script that I am using: $(document).ready(function(){ $("#myForm").validate({ rules: { username: { required:true }, password: { required:true ...

Deserialization does not support the use of Type System.Collections.Generic.IDictionary for an array

An issue might arise when trying to call a page method using a manually created JQuery.ajax request. The deserialization process is handled by .NET and not within the user's code. Javascript: MyParam = []; ... $.ajax({ type: 'POST', ...

New React Component Successfully Imported but Fails to Render

I've encountered issues with the code I'm currently working on. Dependencies: React, Redux, Eslinter, PropTypes, BreadCrumb Within a view page, I am importing components from other files. The current structure is as follows: import Component ...

a hyperlink not functioning properly after the # symbol

I’ve been attempting to obtain the URL in order to share it on Google Plus. I’ve experimented with different codes, but the issue is that the ID value is concealed within the URL, making it impossible to directly pass the link in the "a href" tag. The ...

Error: The outcome of the function is not being displayed

I've been encountering an issue with rendering the result of the function renderVerticalCards. Despite confirming that the function is indeed being called through the console, nothing is displayed in the DOM except for the outer divs from outside the ...