Issue with ThreeJS: Unable to load image from Adobe Scene7 Servers due to XMLHttpRequest error

The textures in my tool are sourced from an Adobe Scene7 server, inspired by Quick-Step's original tool. You can check out the tool at this link: (click on 'start roomviewer'). It appears to be using ThreeJS as well.

For instance, a sample texture loaded into the tool is:

Despite lacking the Access-Control-Allow-Origin header, these textures load seamlessly into their tool.

The Issue

Incorporating one of these remote textures from another Scene7 server onto a plane inThreeJS within my application triggers the following error:

XMLHttpRequest cannot load . The requested resource lacks the 'Access-Control-Allow-Origin' header, restricting access from origin ***.

As mentioned in this Adobe help article, I am advised to place an AccessControlAllowOrigin.xml file somewhere on the Scene7 server. However, this doesn't seem to provide the necessary headers for the image like the ones in the quoted URL. Interestingly,even the original QS tool manages without these headers, leaving me uncertain whether the issue lies with my ThreeJS code or Scene7 itself.

Below is the code snippet used to load the image:

var loader = new THREE.TextureLoader();
loader.crossOrigin = 'anonymous';

loader.load('http://s7g4.scene7.com/is/image/UnilinROWRender/qs-flr_400000020-e-h',
    // Function when resource is loaded
    function (text) {
        geometry = new THREE.PlaneGeometry(20, 20);
        material = new THREE.MeshBasicMaterial({ map: text, side: THREE.DoubleSide });
        plane = new THREE.Mesh(geometry, material);
        anchor.add(plane);
    },
    // Function called when download progresses
    function (xhr) {
        console.log((xhr.loaded / xhr.total * 100) + '% texture loaded');
    },
    // Function called when download errors
    function (xhr) {
        console.log('An error happened while loading texture: ', xhr);
    }
);  

What could be missing in my setup that prevents successful use of the texture?

Answer №1

Hey there! Your texture load function seems to be working well. The issue might be related to the headers on the website where you are trying to fetch the image from. It could be that the website does not allow requests from your app, or your app is not accepting images from this particular site.

The best solution would be to download the image and use a local URL in your project instead.

If that doesn't work, you can also refer to https://developer.chrome.com/extensions/xhr

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

Generating a highchart visualizing a pie chart using data from a local JSON file (OBJECT)

This is the JSON data from my JSON file {"diskspace":100,"diskspace.free":50,"time":8,"time.played":2,"controllers":25,"controllers.used":3, "controllers.new":10, "controllers.broken":12} I want to represent this JSON data in various forms of pie cha ...

What could be causing the Babel installation to fail within Electron? Is Babel necessary for my project or can it be avoided?

Having trouble using the npm package https://www.npmjs.com/package/swipe-detect and encountering the following error message: export default function(target, callback, threshold=150) { ^^^^^^ SyntaxError: Unexpected token export at Module._compile (i ...

Using $state.go within an Ionic application with ion-nav-view may cause unexpected behavior

I recently started working on an Ionic Tabs project. I have a button called "initiateProcess" that triggers some operations when clicked using ng-click. Within the controller, it performs these operations and then navigates to a specific state (tab.target) ...

Incorrect use of the jQuery .height() method

I am working on creating a responsive div with a sloped edge that needs to adjust according to the screen size. I have successfully maintained a consistent angle across all screen sizes, but I am facing an issue where the height calculation for $('#sl ...

What is the function of the 'this' keyword within a Vue component?

Can someone explain how the keyword 'this' is able to access tasks that are not within the same object? anyobject = { template: '#task-list', props: { tasks: {default: []} }, data() { return { newTask: '&apos ...

Can I specify which modal or component will appear when I click on a component?

Working on a small Angular 5 project, I have a simple component that represents a food product shown below: [![enter image description here][1]][1] This component is nested within my main component. When this component is clicked, a quantity component/m ...

Disallow the use of restricted globals in a TypeScript project when utilizing Object.values in ESLint

Encountering an ESLint error related to no restricted globals: const objectParamsAllNumbers = (obj: Object) => !Object.values(obj).find(elem => { return isNaN(elem); }); After attempting to include ES2017.Object in the tsconfig, the error i ...

Versatile accordion with separate functionalities for items and panels

When I have different functions for clicking on item and title, clicking on the item works fine but clicking on the panel triggers both functions. Is there a way to resolve this so that I can click on the item using Function_1 and click on the panel using ...

Why can't the near/far values be reset in Three.js Spotlight?

After meticulously crafting a spotlight, I executed the following steps: let spotLight = new THREE.SpotLight( color, intensity ); spotLight.castShadow = true; spotLight.shadow.mapSize.width = shadowSize; spotLight.shadow.mapSize.height = shadowSize; spo ...

Issue encountered when setting up Webpack development server resulted in the failure to generate

Is anyone else experiencing difficulties when trying to create a static folder named "dist"? Package.json "scripts": { "start": "webpack-dev-server --open", "dev": "webpack --mode development --watch ./frontend/src/index.js --output ./frontend/static/fr ...

What is the best way to retrieve the data-id from a button that has been appended?

JavaScript $("#btn").on('click', function(){ $("#result").append("<button type='button' id='btnid' data-id='show' //want to retrieve this class='close pull-right' aria-hidden='true&apos ...

Tips for ignoring preflight response in AngularJS

When I send a http.post request to my service, I start by sending an Option request as required by Cors. However, I've noticed that the OPTIONS (pre-flight) request does not return any response.data, whereas the POST request does. This creates an iss ...

What could be causing my JSON array to not display an input type radio for every line?

I am puzzled as to why the radio is displaying all the choices in one line instead of individually. I'm attempting to create a quiz/result code. HTML FILE <html><br> <head><br> <meta charset="UTF-8"><br> <title ...

Sending data over a network using Socket and node.js

Trying to update a location on a Google Map using socket.io and node.js. I have 2 different methods for updating the map. There may be some basic issue as I am new to this. 1) Method using an API call that works: app.post('/location', function( ...

Exploring the process of connecting search values in MongoDB using Mongoose

In the /search/:query route, I have the code snippet shown below: var param = { query: req.query['query'] } MyModel.find({ "$or": [ { 'name': req.param.query }, { 'age': req.param.query } ...

Typescript declaration specifies the return type of function properties

I am currently working on fixing the Typescript declaration for youtube-dl-exec. This library has a default export that is a function with properties. Essentially, the default export returns a promise, but alternatively, you can use the exec() method which ...

The information being fetched from the API via the service to the component appears to be in object form and may require conversion to an array format for compatibility

Whenever I receive data, one set works perfectly while another set does not Data that is functioning properly looks like this data: Array(16) On the other hand, the problematic data appears as follows data: Menu1Items: Array(5) > 0 { .... } etc ...

Tips on adding background images to your chart's background

Is there a way to set an image as the background in Lightning Chart using chartXY.setChartBackground? ...

There seems to be an issue with React js Stripe checkout functionality not being

I am attempting to integrate a default Stripe checkout form into my React.js application. <form action="/your-server-side-code" method="POST"> <script src="https://checkout.stripe.com/checkout.js" className="stripe-button" data-key="pk_ ...

The process of implementing sticky headers that stay in place while scrolling in a React application

I have a challenge with organizing tables based on date, using headers like (today, yesterday, last week, ...) and I want to make them sticky depending on the current table in the viewport. I attempted to implement this functionality using the react-sticky ...