P粉4156323192023-08-22 10:36:26
Just to be clear - yes, the error is saying that you cannot point directly in the browser to file://some/path/some.html
Here are some options for quickly launching a local web server to let your browser render local files
If you already have Python installed...
Use the command cd /path/to/your/folder
Go to the folder containing your file some.html
or file
Use commandpython -m SimpleHTTPServer
Start the Python Web server
This will start a web server on http://localhost:8000
to host your entire directory listing
python -m SimpleHTTPServer 9000
, the link is: http://localhost:9000
This method is built into any Python installation.
Perform the same steps, but use the following command: python3 -m http.server
If you are using Visual Studio Code, you can install the Live Server extension, which provides a local web server environment.
Or if you need a more responsive setup and are already using nodejs...
By entering npm install -g http-server
Installhttp-server
Switch to the working directory containing some.html
Start your http server by issuing http-server -c-1
http://localhost:8080
ruby -run -e httpd . -p 8080PHP
php -S localhost:8000
P粉4366889312023-08-22 10:26:48
My crystal ball tells me that you are loading the model using file://
or C:/
, which fits the error message since they are not http:// /
So you can install a web server on your local machine, or upload the model elsewhere, and use jsonp
and change the URL to http://example.com/path/ to/model
Origin is defined in RFC-6454
...它们具有相同的 方案、主机和端口。(有关详细信息,请参见第4节。)
So even if your files originate from the same host (localhost
), they are considered different as long as the scheme is different (http
/ file
) the origin.