I'm using the Aurelia CLI for a data visualization project and can successfully import .json data files from within my src/ directory with
d3.json('src/data/patient-data.json', (data:JSON) => { ... }
when running with "au run" and pointing the browser to localhost:9000.
However, if I open my index.html file statically within a browser, everything else on the page works just fine, except my data won't load and I get the error:
XMLHttpRequest cannot load file:///D:/Webstorm%20Projects/ag-grid-aurelia-example-master/src/data/patient-data.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
How can I fix this? And why is it a cross origin request when the file is coming from within my own src directory?
I don't understand why it works fine with 'au run' but not when opened directly from index.html. Does it have something to do with the json file not being included in the bundling process?
And while I'm already using d3 for other things, I'm not necessarily tied to using it to import json files specifically, if that has anything to do with the problem. I just need to load them in somehow.
Related
We're trying to serve a React app via Spring Boot.
Spring is able to serve the CSS folder's css files (src/main/resources/static/css/), but is not able to serve the JS folder's files (src/main/resources/static/js/). There is a main.8f965741.chunk.js inside the JS folder, and when we run the application, it is returning an error 404.
It is not a browser/caching issue.
It is not a folder/file permissions issue.
Any thoughts on how to debug this? Spring gives us essentially no output for the 404.
You can turn on DEBUG (or TRACE) level logs by adding the following to your application.properties:
logging.level.org.springframework.web: TRACE
Then try requesting the JS file directly, perhaps with curl (e.g., curl http://localhost:8080/js/main.8f965741.chunk.js)
The logs should tell you how the request was mapped and how it was subsequently handled. You can compare the logs generated here with a "known good" request (perhaps from requesting a css file).
If you've built a .jar or .war artifact, you can also unpack it (using jar xf ...) and double check if the js files are properly packaged there.
fetch started throwing "only absolute urls are supported" whenever my redux app was rendered on the server, but worked perfectly fine client-side. It also used to work for relative URLs so I don't know what went wrong.
Help?
It turns out I was no longer importing fetch from domain-task - somehow I had lost the following line:
import { fetch } from 'domain-task';
Since fetch is also native, the compiler didn't complain, and it worked client-side. This line fixed it for the server-side render.
All,
I am following a tutorial to get PHP to deliver a pass. I have been using the console to check the logs in XCODE. I have also checked and there is no PHP errors on the local server.
When I browse to the page which should download the pass, I get this on my safari screen on my iPhone.
So it is downloading from the local server, but I cannot see the pass, just the binary code.. Is there anything on iPhone 6/ iOS 8 that I should be checking ?
thanks
Your web server is not correctly set up to serve the file with a MIME type that identifies the .pkpass file as a Passbook pass. More so, your server appears to be using a text or html MIME type that instructs the browser to read the file as text.
See my answer to this question for how to properly configure your server.
Hi I and currently doing all my THREE.js things on file:///.
When I follow tutorials to load models they do
var myLoader = new THREE.JSONLoader();
myLoader.load( url-path-to-file );
The error:
XMLHttpRequest cannot load file:///C:/.../.../.../testmodel.js. Cross origin requests are only supported for HTTP. three.js:11996
THREE.JSONLoader: "./testmodel.js" seems to be unreachable or the file is empty. three.js:11952
Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///C:/.../.../.../testmodel.js'.
Because of the limitations of using the file protocol I cannot load things like this. I am wondering how to skip this? I am thinking of storing the exported blender as a JavaScript object and then maybe there is already a piece of THREE.js that can do the rest for me?
Run a python web server from your root directory is what I have done to avoid XSS related errors. I have python installed in windows.
Python version 3 in windows from directory that has your HTML file etc:
c:\Python33\python.exe -m http.server
then point your browser to:
http://localhost:8000/yourhtmlfile.html
For more info on running the server for various versions of python / OS see here:
https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
Check out this little project. It is a 3D file viewer and has the ability to load STL and Collada files locally in the client. Works both locally and on a server:
https://github.com/yomboprime/Visor3D
Deriving from the code a local JSON loader function is trivial. Yoy can start modifying the loadDAEFile() function (main.js), which reads local file as text.
I've been trying to use mechanize to download mp3 files, but the server always returns a 404.
Looking at the headers my browser sends (checked on Chrome and FF), I noticed that the If-Range and Range headers are used to initiate a successful download, so I'm guessing the server is rejecting any request that doesn't specify them.
What is the right way to download files in this way, using ruby (Net::HTTP) or bash (curl or wget)?
404 is file not found. Are you sure your URL is correct? If it is correct then you should be able to use wget <full url and file name> to test it.