I just downloaded d3 on my mac and started exploring the examples inside the folder by opening them in firefox. Most of them are working fine except bundle maps. Could any one please help me what is going on ?
I had this problem when I didn't simulate a web server on my machine where I put the code (like MAMP or XAMP). Try using MAMP and put the code in the htdocs folder.
If you're referring to this example, it uses XHR to get the JSON data to generate the graph, and that would result in an error due to attempting to access a local resource on your machine.
Related
My live server on visual studio keeps opening an old html file when i try to open my current one. Ive tried reinstalling the extension but its the same problem. Can anyone help please
i cannot have two project folders with an html file running through the live server. Only one html file can be streamed at one time other wise when trying to stream the second, it will stream the first (Like the issue i was having)
I was having the same problem but later on I find out that, I renamed my project folder while my server was still loading the same project but with the previous folder name so I changed the link to my new folder folder name and it worked for me.
I have live server will simply not work if there was an error in JavaScript file.
Even if you do an alert in the beginning of JavaScript file (for test purposes) but at the end of the file re-define a variable which was already defined before, this error will render liver server not working.
The html page will not respond as well.
Solution is to go to developer tools (F12), see the errors on console, fix them and save and the live server would be back in action! At least that was the case with me.
I had the same issue, sometimes it was an error on the console, or keep showing an old HTML, tried everything, deleting cookies, reinstalling everything and nothing worked,
Eventually, it worked with a hard refresh, what it really worked was to
Go to ---> vs code settings ----> extensions ---> live server config set as chrome private. So far no more errors!
The liveserver extension serves static pages like html files and it does not load javascript or typescript files. You need to setup a server yourself for example in react you use webpack to configure your local server and your app runs on a localhost:port. In a nutshell, you need to write a script for node to run your js files. And you won't need liveserver after that.
I was working on a Angular JS project. Basically it is a purchased theme with Angular JS, HTML, Bootstrap etc. when i tried to run it directly on browser it is broken. but when i run the same in my local server, it works fine.
I understand the importance of setting up a local server when we work on a project with server side language like PHP, .NET. what i am really confused is, why do we need to set up local server to run javascript or any javascript frame work?
Thanks in Advance.
I would like to do these examples by access "file:///C:/TempProjects/GameOfCards/index.html#/" on local computer, but most browsers cannot access these files on local computer do to Cross Origin issues. Here a StackOverflow question and answer that describes this issue: Cross origin requests(CORS) are only supported for HTTP but it’s not cross-domain. So we need a web server
There is another way, by adding a switch in your browser(chrome in this case)-
--allow-file-access-from-files
But, I suggest, running a simple server is the best way of working with things. Hope it helps. Happy Coding.
it happened for me . and I got that , when you run a js project directly , the address of some dependencies will change . for example your index is in c://www directory . if you want to open a html file which it's address in routing is in
c://www/public/... the routing would be different . because when run on a server the www directory is running and your home directory is that . but when you run directly, your home directory is where your index file is ...
I am trying to learn ThreeCSG.js, the javascript Constructive Solid Geometry front-end to Three.js. I thought I would start by copying a minimal example from the web. I tried to save a local copy of Chandler Prall's amazing little javascript Constructive Solid Geometry example using ThreeCSG.js from the site
https://stemkoski.github.io/Three.js/CSG.html
When I made a local copy of the page (using Chrome's Save as webpage, complete command), I found that the checkerboard texture file was missing. I got the following javascript console error:
Failed to load resource: net::ERR_FILE_NOT_FOUND
with the full path name of the (missing) jpg file. When I manually downloaded the jpg file and put it where Chrome was looking for the jpg file, I got a different error:
The cross-origin image at file:///C:/tmp/images/checkerboard.jpg may not be loaded.
My browser is Chrome 43.0.2357.134, Windows 7 64. I ran into similar problems with IE. Thinking it might be a bug/feature of three.js, I tried the most recent version of three.min.js, but got syntax errors. (The example uses an older version of threecsg.js, and the API has changed.)
What am I doing wrong?
It does not download the image directory so notable to load that and throws the error here in code
var floorTexture = new THREE.ImageUtils.loadTexture( 'images/checkerboard.jpg' );
you need to download that image and use any webserver to render the html page as it is making ajax request to render that image
The Problem you are facing is called CORS.
You need to configure your browser according to this github wiki article:
How to run things locally
Pasting links without further information is bad practise, but the settings depend on what browser you are using.
Another solution is to run it on a local server, how to do so is also explained in the second link.
If you are using Chrome and it's just for testing, there is a Chrome extension that will Allow-Control-Allow-Origin
The main problem is you are fetching the file locally. The file need to be fetched from the server. So the best choice is use some IDE like net beans and execute it as a Web Application
Seems obvious to recreate a site -- just copy the files over and it should work. But it doesn't for me. I've tried copying down all the scripts, images, and .html files but it doesn't seem to be displaying anything. All the paths are right btw, and still all black.
This is the website.
Advice?
try to run it for local web server like apache
if you are using windows try use wamp server
Please Checkout this link for how to run three.js on local machine
https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally
I have an interesting problem that has me scratching my head a bit, and I have not been able to find anyone who has encountered the same issue.
I have a website that I am developing locally, built off a custom javascript framework that is tested and working. As part of the setup, the site pulls in a JSON file to determine some structures. All links within the entire project are relative links.
Last week, I zipped up my files, threw them on google drive, and downloaded them onto my personal laptop at home. My home machine is running OS X Yosemite, my work machine is on Mavericks.
When I downloaded and unzipped the files on my Yosemite machine, suddenly Safari and Chrome both started kicking back cross domain errors on the XMLHttpRequest that pulls in the JSON file. Nothing has changed in the file configuration, and again, all links are defined as relative links.
At home, I got around this by just setting up a quick vhost and throwing everything onto my development server. However, I don't have admin rights on my work machine, and now that I have brought the files back to this machine to work, the issue has followed along to this machine.
I use the the same browsers to test that I use to browse online on this machine, so I'm not comfortable disabling the restriction in security settings, and, moreover, I see absolutely no reason why this should even be happening.
Has anyone encountered this issue before? What could possibly have changed, and what could I possibly be overlooking? Projects on this machine that use the same javascript framework (and therefore are making the exact same calls to the file system) work fine when launched from Finder. It's only the files that were uploaded to google drive and subsequently downloaded to my Yosemite machine that are kicking back the error.
Any ideas or suggestions would be hugely appreciated. This is proving to be a big pain and I'm rather flummoxed as to the cause.
Thanks!!