The texture loaded by TextureLoader.load() has no defined image in IE11

I recently used Three.js to create a stunning 3D globe for my website. To display textures on this globe, I implemented the following code snippet:

var loader = new THREE.TextureLoader();

loader.load(imageString, function (texture) {

    var sphere = new THREE.SphereGeometry( RADIUS, SEGMENTS, RINGS );

    var material = new THREE.MeshBasicMaterial( {
        map: texture,
        overdraw: 0.5
    });

    globeMesh = new THREE.Mesh(sphere, material);

    globe.add(globeMesh);

});

In this code, "imageString" refers to the path of an image stored on the server. While this functionality works smoothly on most browsers, there seems to be an issue with IE11. When debugging, I noticed that the texture object retrieved in the load() function lacks the image property in IE11, unlike other browsers where it retains the string value from "imageString".

Does anyone have insights into why this might be happening? Could this possibly be a known bug specific to IE11? I even tried including a Promise polyfill just to troubleshoot, but unfortunately, that didn't resolve the issue.

Answer №1

Have you tried using the <script type="module"> in your code? If yes, then it's important to note that IE 11 does not support this feature. I tested the same geometry_cube example mentioned by Mugen87 and observed that IE does not work with the import method for Three.js as shown below:

<script type="module>
    import * as THREE from '../build/three.module.js';
    var camera, scene, renderer;

This resulted in compatibility issue as seen in the screenshot provided.


Resolution:

To make sure that importing Three.js works on IE, you must utilize the older method like so:

<script src="../build/three.min.js"></script>
<script>
    var camera, scene, renderer;
    // ...

Using this older approach solves the problem! As Three.js gradually transitions to the module technique, you'll notice that the entire threejs examples section won't be compatible with IE 11:

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 more efficient method for passing a function as an argument using the keyword "this"

When it comes to passing a function as an argument that uses the this keyword, is there a preferred method or correct way to do so? An example would be helpful in understanding this concept better: For instance, if I want to fade out an object and then r ...

Creating a unique chrome extension that swaps out HTML and JavaScript components

Is there a possibility to create a Chrome extension that eliminates the JavaScript and CSS from a website while it loads, replacing them with new scripts from a separate source? For example, changing 'Old script' to 'new script', or &a ...

Updating the value of a Redux-Form Checkbox Field using programming methods

I have created a registration form where users can accept or decline the terms of services. When a user accepts the terms, they click a button to check the checkbox. If they decline, the button will uncheck the checkbox. https://i.sstatic.net/mfkcY.png ht ...

How can you use jQuery to display an image when hovering over text?

Looking for a tutorial or script that displays an image when hovering over HTML text with the mouse? ...

Using Javascript to iterate over an array

Issue: I am facing a challenge with updating an array containing image links. The goal is to add new image links while retaining previously uploaded images in the array. However, the problem arises when the previous image links are getting combined. See ex ...

Can you include both a routerLink and a click event on the same anchor tag?

I am facing an issue with my li elements. When a user clicks on them, it should open a more detailed view in another component. However, I noticed that it takes TWO clicks to show the data I want to display. The first click opens the component with an em ...

There appears to be an issue with displaying the graph

I am having trouble understanding how to transfer the values entered in the input to the graph that is displayed successfully. Although the update seems correct, nothing changes when I try to update it and the data remains stagnant. Page.vue <script&g ...

Modify a JavaScript object in JSON format using another object as reference

Consider two JSON formatted JavaScript objects: obj1 = { prop1: 1, prop2: 2, prop3: 3 } obj2 = { prop1: 1, prop2: 3 } In the context of jQuery or Angular, what is the recommended practice to update obj2 into obj1 while also re ...

AngularJS and Handlebars (npm)

Is it possible for angularJS to function as a substitute for the "view engine" in nodeJS? I am seeking insights on the optimal method to use. (Do MEAN Stack developers utilize view engines? Or do they prefer using res.sendFile along with tools like ui-ro ...

Tips for saving the status of an accordion controlled by an angular directive

I am currently utilizing the accordion directive from angular-bootstrap. My goal is to save the is-open attribute of this accordion, so that when users navigate to another page on the website, the state of the accordion (i.e. is-open) remains unchanged. ...

When the button is clicked, the ng-click event will trigger the addClass function, but only on the second click

My bootstrap alert has this structure: <div id="errorAlert" class="alert col-md-6 col-md-offset-3 fadeAlert" ng-if="itemExistsAlert"> <button type="button" class="close" data-dismiss="alert">&times;</button> <p>{{alertM ...

Ways to retrieve PHP variables using JavaScript from an external file

Within the <div id="chtmsg"> of a messenger page, I had this code... PHP : if($questions){ for($c=0;$c<count($questions);$c++){ $questions[$c]->type == 'F' ? $class = 'message_F' : $class = 'message_P'; ...

Setting up a React Package by reinstalling a git repository

While immersing myself in learning React JS, I decided to create a git repository containing React components that could be exported and used or installed as a package in a separate React application. I developed some UI Components in a git repository and ...

Struggling with Rendering Dynamic Components in Vue.js? Let us lend you a helping

Hey there, I'm facing a specific situation. I have a parent component called Health Profile that displays a list of child subcomponents, each with an add button. I would like the application to work in a way that when a user clicks on the add button, ...

Guide to implementing 'active' state in Bootstrap 4 using JavaScript on a basic PHP website

A simple website consisting of three pages, designed using Bootstrap 4 framework. I have utilized includes to incorporate header.php and footer.php into the respective PHP pages below. My challenge lies in adding the 'active' class from Bootstrap ...

JavaScript library designed for efficient asynchronous communication with servers

Looking for a lightweight JS library to handle AJAX cleanly and simplify basic DOM selections on our website (www.rosasecta.com). Currently, we're manually coding a lot of Ajax functionality which is not only ugly but also difficult to manage. We&apos ...

Guide to separating the bytes of a number and placing them into an Uint8Array

I am looking to convert a JavaScript number into the smallest possible uint8array representation. For example : 65 535 = Uint8Array<[255,255]> (0b1111111111111111 = [0b11111111, 0b11111111]) 12 356 = Uint8Array<[48,68]> (0b0011000001000100 = [ ...

Error: Attempting to access property 'mouseX' of an undefined object was unsuccessful

Currently, I am utilizing AmCharts to generate a graph displaying payments made over time. The configuration setup for AmCharts seems accurate. Just to mention, I do not possess expertise in Javascript. Utilizing AmCharts 3.18.3.free The complete conso ...

What is the process of generating a popup panel without relying on libraries, using JavaScript and CSS?

I'm currently working on creating a popup panel that is centered on the screen with rounded corners (scrollbars are unnecessary) using jQuery min, similar to this example: https://i.stack.imgur.com/0kYO6.png My progress so far: function (package) ...

Generate a mesh representing an airplane, with vertices specifying various hues

After creating approximately 2500 meshes, I implemented an algorithm to determine the color of each mesh. The algorithm calculates a value based on the distance of each mesh to a "red-start" point, which then determines the final color. However, the curre ...