Experiencing issues with Panolens.js failing to load images

Currently, I am in the process of setting up a basic 3D image viewer using Panolens.js. Despite following the example provided in the documentation, I am encountering console errors during the loading process. This is my initial attempt at working with equirectangular photography and Panolens/ThreeJS.

Below is the code snippet that I have included:

var panorama, viewer;

panorama = new PANOLENS.ImagePanorama('http://via.placeholder.com/720x360');

viewer = new PANOLENS.Viewer({
output: 'console'
});
viewer.add(panorama);
html,
body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
}

a:link,
a:visited {
color: #bdc3c7;
}

.credit {
position: absolute;
text-align: center;
width: 100%;
padding: 20px 0;
color: #fff;
}
<script src="https://pchen66.github.io/js/three/three.min.js"></script>
<script src="https://pchen66.github.io/js/panolens/panolens.min.js"></script>
<div class="credit"><a href="https://github.com/pchen66/panolens.js">Panolens.js</a> image panorama example. Image from <a href="http://adaptivesamples.com/tag/equirectangular/">Adaptive Samples</a></div>

The console error reads as follows:

Failed to load file:///Volumes/Nifty/DoVR%20Media/demo_v1/test.jpg: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

I am utilizing an image stored in the same directory. Additionally, I attempted loading the image from imgur, but this also resulted in an error message.

Answer №1

The error you encountered is due to opening your index.html page as a local file in the browser. The address bar will show file://path_to_your_file.

For more information on this issue, visit this helpful link.

To avoid this error, it is recommended to launch a web server. For example, if you have python installed, you can use the simple web server that comes with it. Refer to the link above for more details.

Another option is to install VSCode and add the Live Server extension. Open the folder in VSCode and click on Go Live button to resolve the issue.https://i.sstatic.net/WYw4d.png https://i.sstatic.net/VioQj.jpg

I successfully ran your code in VSCode with LiveServer and everything is functioning properly.

Answer №2

For ensuring security, if the panoramic image you have included is hosted on a different server, that server should use SSL (https). Make sure to update the url from http to https:

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 Vuetify badges and icons with createElement in the render function: A step-by-step guide

Within my Vue application, I utilize a v-data-table. The column values are generated using a render function within a functional component as illustrated below: render(createElement) { if (this.$props.format) { return this.$props.format(this.ite ...

The window resizing function continues on an endless loop

I could really use some assistance in pinpointing the issue at hand! My script is set up to display a banner at the top of a page only if the window width is 600px or less and the scroll position is within 34px from the top. It hides the banner when the u ...

Disregarding NPM dependencies for individual packages

I need to include a package (d3.js) in my project's package.json. However, when I run npm install, I do not want npm to install any dependencies related to d3.js or run any install scripts for it. Essentially, I want npm to only fetch and unpack the p ...

What is the process for incorporating a glossiness / specular texture onto a GLTF model?

QUERY: I currently possess a specular/glossiness texture image for a model that has not yet been integrated into the GLTF model. Is there a way to incorporate/add this texture to my model in order to achieve a reflective/glossy appearance where required? ...

Tips for implementing a checkbox (with tick/untick functionality) as a replacement for a plus/minus toggle using HTML

Is it possible to use checkboxes instead of plus and minus signs for expanding and collapsing sections? Can the plus and minus symbols be incorporated into the checkbox itself, so that clicking on the checkbox toggles between plus and minus states? Any hel ...

Using an arrow function in Aurelia to read a json file

I've been exploring Aurelia and delved into tutorials on PluralSight and Egghead.io, but I'm still struggling to resolve my current issue. In a JSON file named bob.json, there is a collection of objects related to Bob. Each object in the collect ...

Using HTML and CSS to create a Contact Form

Greetings! I have come across this contact form code: /* Custom Contact Form Styling */ input[type=text], [type=email], select, textarea { width: 100%; padding: 12px; border: 1px solid #555; margin-top: 6px; margin-bottom: 16px; resize: v ...

The token endpoint in Nuxtjs auth module's configuration for auth strategies is not being triggered

Our system has two important endpoints, namely /auth and /token. The endpoint /auth is responsible for providing the authorization code required to call /token in order to obtain an access token. The utilization of NuxtJS has made the auth module a prefer ...

Difficulty with BCRYPT retrieving information from MySQL

As a beginner in programming, I've hit a roadblock and can't seem to find any solutions. I've managed to successfully register users into my database and hash their passwords. Now, I'm trying to implement a login feature for these users ...

Using setInterval to perform an AJAX call and update a textarea may not function properly on Internet Explorer 8

I have developed a webpage that serves as a real-time log for monitoring a `txt` file continuously updated on Unix. To achieve this, I am utilizing Ajax requests to fetch data from a PHP script which reads the file and populates the content into a `textare ...

Determine the value of an object by iterating through its keys

UPDATE: (for clarification) I currently have a table named modelCoa +----+----------+-------+--------------------+ | id | id_parent| code | name | +----+----------+-------+--------------------+ | 1 | 0 | 1 | asset ...

Optimizing workflow with express.js, backbone.js, and connect-assets for maximum efficiency

As a newcomer to node.js, I'm embarking on the challenge of setting up an application that utilizes Backbone.js on the client-side while being supported by express.js and node.js for server-side extensibility. The lack of online examples showcasing a ...

Difficulty with parsing JSON in JavaScript and retrieving values by key

I'm encountering an error response within the ajax error function; $.ajax(Request).error(function (Response) { var content = JSON.stringify(Response.responseText); var obj = JSON.parse(content); console.log("Response.r ...

How do I collapse the sidebar in mobile and tablet view using Bootstrap 4?

I am trying to create a collapsible sidebar that expands on large screens such as lg, but collapses with a visible button for tablet and mobile views (md or smaller). How can I achieve this responsive behavior for my sidebar on mobile and tablet views? It ...

Tips for conducting key down event testing on a material ui MenuList element utilizing react-testing-library

Looking to test the key down event on my MenuList component. Component: import MenuItem from '@material-ui/core/MenuItem'; import MenuList from '@material-ui/core/MenuList'; import * as React from 'react'; export default fu ...

Update and change the property based on a condition in Ramda without the need for a lens

I am looking to modify properties for an object in ramda.js without using lenses. Given the data provided, I need to: If objects in array properties in a and b do not have the property "animationTimingFunction", then add the property key "easing" with a ...

Transform a string into a JSON entity

Can JavaScript be used to convert a string such as this: "Product : Bike , 2005 : $12000,2006 : $13000,2007 : $14000,2008 : $15000" into a JSON object like the one below: { "Product":"Bike", "2005" : $12000, "2006" : $13000, "2007" : $14 ...

Cease all playback of audio immediately

My goal is to ensure that any audio that has been played previously stops before a new audio clip starts playing. This will prevent overlapping clips on elements that may trigger the audio file multiple times. I have attempted to pause and reset the curre ...

Unexpected issue with Ajax form submission when using the submitHandler function in Jquery

I am faced with the challenge of validating a form using the jQuery Validation Plugin and submitting data to a database without refreshing the page. Despite marking all fields in my form as required, the issue arises where empty fields are still submitted, ...

Arrange the Json array by key value in a different order

I have a contact list that is returning in a lengthy form, organized based on order of entry. I am looking to alphabetically sort the list by displayName which is nested within the main array. Can anyone assist with this challenge using JavaScript? Thank ...