Hi to all
I am new in three.js.
I use three js editor for create an environment.
after publish project, my project run on edge properly but not properly in firefox or chrome.
I have only black screen in firefox and chrome
Hi to all
I am new in three.js.
I use three js editor for create an environment.
after publish project, my project run on edge properly but not properly in firefox or chrome.
I have only black screen in firefox and chrome
Are there any errors in the devtools?
thank you.
I have 3 errors in console:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/Users/user/Desktop/untitled/js/three.module.js. (Reason: CORS request not http)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/Users/user/Desktop/untitled/js/app.js. (Reason: CORS request not http)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///C:/Users/user/Desktop/untitled/js/VRButton.js. (Reason: CORS request not http)
my code is:
<head>
<title></title>
<meta charset="utf-8">
<meta name="generator" content="Three.js Editor">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: sans-serif;
font-size: 11px;
background-color: #000;
margin: 0px;
}
canvas {
display: block;
}
</style>
</head>
<body ontouchstart="">
<script type="module">
import * as THREE from './js/three.module.js';
import { APP } from './js/app.js';
import { VRButton } from './js/VRButton.js';
window.THREE = THREE; // Used by APP Scripts.
window.VRButton = VRButton; // Used by APP Scripts.
var loader = new THREE.FileLoader();
loader.load( 'app.json', function ( text ) {
var player = new APP.Player();
player.load( JSON.parse( text ) );
player.setSize( window.innerWidth, window.innerHeight );
player.play();
document.body.appendChild( player.dom );
window.addEventListener( 'resize', function () {
player.setSize( window.innerWidth, window.innerHeight );
} );
} );
</script>
</body>
Unfortunately you need to run a web server.
https://threejs.org/docs/index.html#manual/en/introduction/How-to-run-things-locally
If you are new to three.js, the collection may help you.
Read there * discourse.threejs.hofk.de first also:
Module usage … Local use of the examples
GetSource