Is transcrypt supposed to run from the local filesystem? - google-chrome

I've installed Transcrypt, compiled the Hello Solar System demo, and run it as instructed using the python web server.
However, I was also able to run the hello.html file directly from Chrome on Windows 10 ... once. Subsequently it refuses to run - the buttons appear but clicking them does not update the text.
------- EDIT ---------
Thanks - CORS is the problem - the browser must connect to a web server, not a file on the local filesystem.

You've probably run into a security policy of Chrome called CORS. Start a webserver from the directory where your html file is, using python -m http.server, and browse to localhost:8000. In your browser window, click on the html file and things should work.

Related

How to render dynamic Visuals using D3.js on Google Chrome using a local desktop server?

I have managed to develop D3.js visuals on Mozilla Firefox using a local computer and no server. But if I want to develop it on Google Chrome, only static data (and not dynamic) can be rendered.By Dynamic i mean, having a Dropdown on front end and a csv at back end to pull the data from.
Run a local server.
From the command line in the directory where index.html resides, run the following python command:
python -m SimpleHttpServer
This will serve on localhost:8000 by default. If python isn't you style, there are numerous other ways that are easily google-able for you to run a local server.
For more information about how to set up a beginning dev environment, Mike Bostock writes about it here. He uses http-server from Node for his local server.

Live Reload not working (WIN7)

I have the windows application installed, Live Reload extension for chrome and i'm using Sublime Text with Live Refresh and Live Reload plugins. For some reason any HTML doc i edit on sublime text is not auto updating on chrome. The extension is stuck on "Live Reload is connecting" when i enable it. What exactly am i missing, do i need to setup a local web server or something like that?
I think your issue may be that you did not add the folder that contains your HTML document to the LiveReload windows application so that it can monitor for changes to the file.
If you open up the LiveReload app, it should have a list of site folders. Try adding your test project's folder to the list.
If you load from local file it does work you must runt the local file through a web server e.g python -m http.server in the folder your .html exists otherwise the option match to local file never appears and then you can have the save and reload functionality.
I mention it because I hadn't found the problem through reading the post

How to allow-file-access-from-files in Chrome?

I am using Chrome to test some of my WebGL texture programs. According to the book 'WebGL Programming Guide', if I need to access files from my local disk, I should add the option --allow-file-access-from-files to Chrome.
How do I do that?
The short answer is DON'T
Open up a shell/terminal/command line and type
cd path/to/htmlfiles
python -m SimpleHTTPServer
Then in your browser to go
http://localhost:8000
If you find it's too slow consider this solution
The reason you don't want to allow file access is allowing it can be used to steal data from your machine. For example, you go to a site and download some webpage. You then view that page locally. With file access on that locally run page can now access all your files AND upload them to a server.

Opening downloaded Gist folder to inspect elements

I want to experiment with Mike Bostock's stacked bar chart (https://gist.github.com/3886208) in my browser using web inspector. I realize that I need a local copy of the example files (the index.html and the data.csv file) in order to play with it. However, when I download the 'gist' folder and open the index.html file with Chrome, the chart doesn't appear. What am I doing wrong?
Thanks!
With Google Chrome, go to Top Menu > View > Developer > Javascript console. You will see a message
XMLHttpRequest cannot load file:///path/to/data.csv. Cross origin requests are only supported for HTTP.
As per https://github.com/mbostock/d3/wiki
When developing locally, note that your browser may enforce strict
permissions for reading files out of the local file system. If you use
d3.xhr locally (including d3.json et al.), you must have a local web
server. For example, you can run Python's built-in server:
python -m SimpleHTTPServer 8888 &
Once this is running, go to http://localhost:8888/.

HTML 5 GeoLocation in Google Chrome

I am using HTML 5 Geolocations API's for tracking location however I am getting the following error on the Geolocation icon in Chrome Browser
"This Page has been blocked from tracking your Location"
I went to the Preferences and Setting's Page but did not find any help.
In my case the problem was that I opened the HTML file from the file system (file:///...). Browsers generally try to prevent accessing personal information (which includes location) from local files, so you have to serve the file through a web server (even if it is local).
One simple way to serve a static website located in your filesystem is SimpleHTTPServer if you have Python installed. Just navigate to the folder using the command prompt, and say python -m SimpleHTTPServer, and then you can view the file on localhost:8000.
Even I was facing the same problem. One of the solution is to open to file in another browser, I tried in Firefox and it worked fine. Another solution is to open the file through your WAMP server (Local host).
There is a good article here about Geolocation API. You have to go to chrome://settings/content and there, you can find Location information. You should be able to find the exceptions and manage them there.