“Cross origin requests are only supported for HTTP.” error when loading a local file











up vote
673
down vote

favorite
197












I'm trying to load a 3D model into Three.js with JSONLoader, and that 3D model is in the same directory as the entire website.



I'm getting the "Cross origin requests are only supported for HTTP." error, but I don't know what's causing it nor how to fix it.










share|improve this question




















  • 19




    Are you trying to do this locally?
    – WojtekT
    May 25 '12 at 9:42






  • 9




    You need to use localhost, even if its local file
    – Neil
    May 25 '12 at 9:42






  • 19




    But it sin't cross domain!
    – corazza
    May 25 '12 at 10:17






  • 18




    If you're using Chrome, starting it from the terminal with the --allow-file-access-from-files option might help you out.
    – nickiaconis
    Jul 3 '13 at 20:37






  • 10




    Yeah, it's not really cross-domain when the file is in the same folder as the webpage, now is it... I found that if you use Firefox instead of Chrome, the problem goes away.
    – Sphinxxx
    Apr 9 '16 at 2:57















up vote
673
down vote

favorite
197












I'm trying to load a 3D model into Three.js with JSONLoader, and that 3D model is in the same directory as the entire website.



I'm getting the "Cross origin requests are only supported for HTTP." error, but I don't know what's causing it nor how to fix it.










share|improve this question




















  • 19




    Are you trying to do this locally?
    – WojtekT
    May 25 '12 at 9:42






  • 9




    You need to use localhost, even if its local file
    – Neil
    May 25 '12 at 9:42






  • 19




    But it sin't cross domain!
    – corazza
    May 25 '12 at 10:17






  • 18




    If you're using Chrome, starting it from the terminal with the --allow-file-access-from-files option might help you out.
    – nickiaconis
    Jul 3 '13 at 20:37






  • 10




    Yeah, it's not really cross-domain when the file is in the same folder as the webpage, now is it... I found that if you use Firefox instead of Chrome, the problem goes away.
    – Sphinxxx
    Apr 9 '16 at 2:57













up vote
673
down vote

favorite
197









up vote
673
down vote

favorite
197






197





I'm trying to load a 3D model into Three.js with JSONLoader, and that 3D model is in the same directory as the entire website.



I'm getting the "Cross origin requests are only supported for HTTP." error, but I don't know what's causing it nor how to fix it.










share|improve this question















I'm trying to load a 3D model into Three.js with JSONLoader, and that 3D model is in the same directory as the entire website.



I'm getting the "Cross origin requests are only supported for HTTP." error, but I don't know what's causing it nor how to fix it.







javascript file http 3d three.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 2 '14 at 12:33

























asked May 25 '12 at 9:41









corazza

12.1k2989161




12.1k2989161








  • 19




    Are you trying to do this locally?
    – WojtekT
    May 25 '12 at 9:42






  • 9




    You need to use localhost, even if its local file
    – Neil
    May 25 '12 at 9:42






  • 19




    But it sin't cross domain!
    – corazza
    May 25 '12 at 10:17






  • 18




    If you're using Chrome, starting it from the terminal with the --allow-file-access-from-files option might help you out.
    – nickiaconis
    Jul 3 '13 at 20:37






  • 10




    Yeah, it's not really cross-domain when the file is in the same folder as the webpage, now is it... I found that if you use Firefox instead of Chrome, the problem goes away.
    – Sphinxxx
    Apr 9 '16 at 2:57














  • 19




    Are you trying to do this locally?
    – WojtekT
    May 25 '12 at 9:42






  • 9




    You need to use localhost, even if its local file
    – Neil
    May 25 '12 at 9:42






  • 19




    But it sin't cross domain!
    – corazza
    May 25 '12 at 10:17






  • 18




    If you're using Chrome, starting it from the terminal with the --allow-file-access-from-files option might help you out.
    – nickiaconis
    Jul 3 '13 at 20:37






  • 10




    Yeah, it's not really cross-domain when the file is in the same folder as the webpage, now is it... I found that if you use Firefox instead of Chrome, the problem goes away.
    – Sphinxxx
    Apr 9 '16 at 2:57








19




19




Are you trying to do this locally?
– WojtekT
May 25 '12 at 9:42




Are you trying to do this locally?
– WojtekT
May 25 '12 at 9:42




9




9




You need to use localhost, even if its local file
– Neil
May 25 '12 at 9:42




You need to use localhost, even if its local file
– Neil
May 25 '12 at 9:42




19




19




But it sin't cross domain!
– corazza
May 25 '12 at 10:17




But it sin't cross domain!
– corazza
May 25 '12 at 10:17




18




18




If you're using Chrome, starting it from the terminal with the --allow-file-access-from-files option might help you out.
– nickiaconis
Jul 3 '13 at 20:37




If you're using Chrome, starting it from the terminal with the --allow-file-access-from-files option might help you out.
– nickiaconis
Jul 3 '13 at 20:37




10




10




Yeah, it's not really cross-domain when the file is in the same folder as the webpage, now is it... I found that if you use Firefox instead of Chrome, the problem goes away.
– Sphinxxx
Apr 9 '16 at 2:57




Yeah, it's not really cross-domain when the file is in the same folder as the webpage, now is it... I found that if you use Firefox instead of Chrome, the problem goes away.
– Sphinxxx
Apr 9 '16 at 2:57












22 Answers
22






active

oldest

votes

















up vote
691
down vote



accepted










My crystal ball says that you are loading the model using either file:// or C:/, which stays true to the error message as they are not http://



So you can either install a webserver in your local PC or upload the model somewhere else and use jsonp and change the url to http://example.com/path/to/model






share|improve this answer



















  • 7




    Yeah, I'm trying to do this using file://, but I don't understand why this is permitted. Well, I'm installing Lampp I guess...
    – corazza
    May 25 '12 at 9:46






  • 129




    Imagine if that is allowed and a webapp whereby the author of the page uses something like load('file://C:/users/user/supersecret.doc') and then upload the content to their server using ajax etc.
    – Andreas Wong
    May 25 '12 at 9:50






  • 10




    unfortunately, policy is made for all cases, not only for yours :(, so ya gotta bear with it
    – Andreas Wong
    May 25 '12 at 9:54






  • 27




    There is a page for this topic in the GitHub wiki: github.com/mrdoob/three.js/wiki/How-to-run-things-locally
    – Felipe Lima
    May 29 '12 at 8:18






  • 24




    You may also use the --allow-file-access-from-files switch in chrome. Per my answer here: stackoverflow.com/questions/8449716/…
    – prauchfuss
    Sep 8 '13 at 19:43




















up vote
525
down vote













Just to be explicit - Yes, the error is saying you cannot point your browser directly at file://some/path/some.html



Here are some options to quickly spin up a local web server to let your browser render local files



Python 2



If you have Python installed...




  1. Change directory into the folder where your file some.html or file(s) exist using the command cd /path/to/your/folder


  2. Start up a Python web server using the command python -m SimpleHTTPServer



This will start a web server to host your entire directory listing at http://localhost:8000




  1. You can use a custom port python -m SimpleHTTPServer 9000 giving you link: http://localhost:9000


This approach is built in to any Python installation.



Python 3



Do the same steps, but use the following command instead python3 -m http.server



Node.js



Alternatively, if you demand a more responsive setup and already use nodejs...




  1. Install http-server by typing npm install -g http-server


  2. Change into your working directory, where yoursome.html lives


  3. Start your http server by issuing http-server -c-1



This spins up a Node.js httpd which serves the files in your directory as static files accessible from http://localhost:8080



Ruby



If your preferred language is Ruby ... the Ruby Gods say this works as well:



ruby -run -e httpd . -p 8080


PHP



Of course PHP also has its solution.



php -S localhost:8000





share|improve this answer



















  • 3




    This saved me a ton of time thanks. My Python install didnt have the SimpleHTTPServer module but the node instructions worked like a charm.
    – LukeP
    Jul 25 '14 at 3:42






  • 3




    In response to LukeP's comment, in python 2.7 the command does work as per the instructions $ python -m SimpleHTTPServer, which produces the message: Serving HTTP on 0.0.0.0 port 8000 ... If you spell the module name wrong, e.g. $ python -m SimpleHttpServer then you will get the error message No module named SimpleHttpServer You will get a similar error message if you have python3 installed (v. python 2.7). You can check your version of python using the command: $ python --version. You can also specify the port to listen on like this: $ python -m SimpleHTTPServer 3333
    – 7stud
    Nov 20 '14 at 1:06








  • 1




    The python server serves up files from the directory where you start the server. So if the files you want to serve up are located in /Users/7stud/angular_projects/1app, then start the server in that directory, e.g. $ cd ~/angular_projects/1app, then $ python -m SimpleHTTPServer. In your browser enter the url http://localhost:8000/index.html. You can also request files in subdirectories of the directory where you started the server, e.g. http://localhost:8000/subdir/hello.html
    – 7stud
    Nov 20 '14 at 1:18






  • 2




    I've heard that Python is simple and powerful, just like "X" language, but this is ridiculous! No need to install XAMPP, or setup a simple http server js with node to serve static files - One command and boom! Thank you very much, saves a LOT of time and hassle.
    – R.D.
    May 31 '16 at 17:59






  • 1




    AWESOME! - for Python on Windows use: python -m http.server 8080 ...or whatever port you want and when you want to quit it just ctrl-c.
    – Kristopher
    Oct 19 '16 at 15:37


















up vote
148
down vote













In Chrome you can use this flag:



--allow-file-access-from-files


Read more here.






share|improve this answer























  • This does not work for coffee-script issue.
    – Blairg23
    Oct 14 '14 at 5:03






  • 10




    @Blairg23, keep in mind that this solution requires restarting all instances of Chrome.exe for it to work
    – Alex Klaus
    Jun 16 '15 at 23:41






  • 3




    Please, explain how to use it in chrome.
    – Rishabh Agrahari
    Aug 28 '17 at 8:12










  • @Priya Should not do this though
    – Suraj Jain
    Dec 17 '17 at 6:12










  • I would suggest using Chromium only for local debugging (starting it with flag --allow-file-access-from-files). It means using Chrome for common web browsing, and use Chromium as the default application for HTML file.
    – Alan Zhiliang Feng
    May 14 at 11:23


















up vote
53
down vote













Ran in to this today.



I wrote some code that looked like this:



app.controller('ctrlr', function($scope, $http){
$http.get('localhost:3000').success(function(data) {
$scope.stuff = data;
});
});


...but it should've looked like this:



app.controller('ctrlr', function($scope, $http){
$http.get('http://localhost:3000').success(function(data) {
$scope.stuff = data;
});
});


The only difference was the lack of http:// in the second snippet of code.



Just wanted to put that out there in case there are others with a similar issue.






share|improve this answer






























    up vote
    28
    down vote













    Just change the url to http://localhost instead of localhost. If you open the html file from local, you should create a local server to serve that html file, the simplest way is using Web Server for Chrome. That will fix the issue.






    share|improve this answer



















    • 2




      +1 for Web Server for Chrome app link - it's by far the simplest & cleanest solution for temporary httpd setup for Chrome IMO
      – vaxquis
      Jul 8 '17 at 13:08


















    up vote
    13
    down vote













    In an Android app — for example, to allow JavaScript to have access to assets via file:///android_asset/ — use setAllowFileAccessFromFileURLs(true) on the WebSettings that you get from calling getSettings() on the WebView.






    share|improve this answer





















    • Brilliant! We were just about to rewrite methods to inject JSON into variables .. but this works! webView.getSettings().setAllowFileAccessFromFileURLs(true);
      – WallyHale
      Aug 17 '17 at 8:54


















    up vote
    10
    down vote













    For those on Windows without Python or Node.js, there is still a lightweight solution: Mongoose.



    All you do is drag the executable to wherever the root of the server should be, and run it. An icon will appear in the taskbar and it'll navigate to the server in the default browser.



    Also, Z-WAMP is a 100% portable WAMP that runs in a single folder, it's awesome. That's an option if you need a quick PHP and MySQL server.






    share|improve this answer























    • If you install php or you have installed, you can start a server in your folder: php.net/manual/es/features.commandline.webserver.php
      – jechaviz
      Jun 15 '16 at 21:14


















    up vote
    8
    down vote













    If you use Mozilla Firefox, It will work as expected without any issues;



    P.S. Even IE_Edge works fine, surprisingly!!






    share|improve this answer






























      up vote
      7
      down vote













      I'm going to list 3 different approaches to solve this issue:





      1. Using a very lightweight npm package: Install live-server using npm install -g live-server. Then, go to that directory open the terminal and type live-server and hit enter, page will be served at localhost:8080. BONUS: It also supports hot reloading by default.


      2. Using a lightweight Google Chrome app developed by Google: Install the app then, go to the apps tab in Chrome and open the app. In the app point it to the right folder. Your page will be served!


      3. Modifying Chrome shortcut in windows: Create a Chrome browser's shortcut. Right-click on the icon and open properties. In properties, edit target to "C:Program Files (x86)GoogleChromeApplicationchrome.exe" --disable-web-security --user-data-dir="C:/ChromeDevSession" and save. Then using Chrome open the page using ctrl+o. NOTE: Do NOT use this shortcut for regular browsing.






      share|improve this answer






























        up vote
        2
        down vote













        I was getting this exact error when loading an HTML file on the browser that was using a json file from the local directory. In my case, I was able to solve this by creating a simple node server that allowed to server static content. I left the code for this at this other answer.






        share|improve this answer






























          up vote
          2
          down vote













          I suggest you use a mini-server to run these kind of applications on localhost (if you are not using some inbuilt server).



          Here's one that is very simple to setup and run:



          https://www.npmjs.com/package/tiny-server





          share|improve this answer




























            up vote
            2
            down vote













            Use http:// or https:// to create url



            error: localhost:8080



            solution: http://localhost:8080






            share|improve this answer




























              up vote
              1
              down vote













              It simply says that the application should be run on a web server. I had the same problem with chrome, I started tomcat and moved my application there, and it worked.






              share|improve this answer




























                up vote
                1
                down vote













                fastest way for me was:
                for windows users run your file on Firefox problem solved, or
                if you want to use chrome easiest way for me was to install Python 3 then from command prompt run command python -m http.server then go to http://localhost:8000/ then navigate to your files



                python -m http.server





                share|improve this answer




























                  up vote
                  0
                  down vote













                  er. I just found some official words "Attempting to load unbuilt, remote AMD modules that use the dojo/text plugin will fail due to cross-origin security restrictions. (Built versions of AMD modules are unaffected because the calls to dojo/text are eliminated by the build system.)" https://dojotoolkit.org/documentation/tutorials/1.10/cdn/






                  share|improve this answer




























                    up vote
                    0
                    down vote













                    One way it worked loading local files is using them with in the project folder instead of outside your project folder. Create one folder under your project example files similar to the way we create for images and replace the section where using complete local path other than project path and use relative url of file under project folder .
                    It worked for me






                    share|improve this answer




























                      up vote
                      0
                      down vote













                      For all y'all on MacOS... setup a simple LaunchAgent to enable these glamorous capabilities in your own copy of Chrome...



                      Save a plist, named whatever (launch.chrome.dev.mode.plist, for example) in ~/Library/LaunchAgents with similar content to...



                      <?xml version="1.0" encoding="UTF-8"?>
                      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                      <plist version="1.0">
                      <dict>
                      <key>Label</key>
                      <string>launch.chrome.dev.mode</string>
                      <key>ProgramArguments</key>
                      <array>
                      <string>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</string>
                      <string>-allow-file-access-from-files</string>
                      </array>
                      <key>RunAtLoad</key>
                      <true/>
                      </dict>
                      </plist>


                      It should launch at startup.. but you can force it to do so at any time with the terminal command



                      launchctl load -w ~/Library/LaunchAgents/launch.chrome.dev.mode.plist



                      TADA! 😎 💁🏻 🙊 🙏🏾






                      share|improve this answer




























                        up vote
                        0
                        down vote














                        • Install local webserver for java e.g Tomcat,for php you can use lamp etc

                        • Drop the json file in the public accessible app server directory

                        • List item


                        • Start the app server,and you should be able to access the file from localhost







                        share|improve this answer




























                          up vote
                          0
                          down vote













                          I have also been able to recreate this error message when using an anchor tag with the following href:






                          <a href="javascript:">Example a tag</a>





                          In my case an a tag was being used to get the 'Pointer Cursor' and the event was actually controlled by some jQuery on click event. I removed the href and added a class that applies:






                          cursor:pointer;








                          share|improve this answer




























                            up vote
                            0
                            down vote













                            Not possible to load static local files(eg:svg) without server. If you have NPM /YARN installed in your machine, you can setup simple http server using "http-server"



                            npm install http-server -g
                            http-server [path] [options]



                            Or open terminal in that project folder and type "hs". It will automaticaly start HTTP live server.







                            share|improve this answer





















                            • duplicate answer
                              – Scott Stensland
                              Jul 17 at 18:10


















                            up vote
                            0
                            down vote













                            I suspect it's already mentioned in some of the answers, but I'll slightly modify this to have complete working answer (easier to find and use).




                            1. Go to: https://nodejs.org/en/download/. Install nodejs.


                            2. Install http-server by running command from command prompt npm install -g http-server.


                            3. Change into your working directory, where index.html/yoursome.html resides.


                            4. Start your http server by running command http-server -c-1



                            Open web browser to http://localhost:8080
                            or http://localhost:8080/yoursome.html - depending on your html filename.






                            share|improve this answer




























                              up vote
                              -1
                              down vote













                              Many problem for this, with my problem is missing '/' example:
                              jquery-1.10.2.js:8720 XMLHttpRequest cannot load http://localhost:xxxProduct/getList_tagLabels/
                              It's must be: http://localhost:xxx/Product/getList_tagLabels/



                              I hope this help for who meet this problem.






                              share|improve this answer




















                                protected by Community Nov 10 '15 at 8:01



                                Thank you for your interest in this question.
                                Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                Would you like to answer one of these unanswered questions instead?














                                22 Answers
                                22






                                active

                                oldest

                                votes








                                22 Answers
                                22






                                active

                                oldest

                                votes









                                active

                                oldest

                                votes






                                active

                                oldest

                                votes








                                up vote
                                691
                                down vote



                                accepted










                                My crystal ball says that you are loading the model using either file:// or C:/, which stays true to the error message as they are not http://



                                So you can either install a webserver in your local PC or upload the model somewhere else and use jsonp and change the url to http://example.com/path/to/model






                                share|improve this answer



















                                • 7




                                  Yeah, I'm trying to do this using file://, but I don't understand why this is permitted. Well, I'm installing Lampp I guess...
                                  – corazza
                                  May 25 '12 at 9:46






                                • 129




                                  Imagine if that is allowed and a webapp whereby the author of the page uses something like load('file://C:/users/user/supersecret.doc') and then upload the content to their server using ajax etc.
                                  – Andreas Wong
                                  May 25 '12 at 9:50






                                • 10




                                  unfortunately, policy is made for all cases, not only for yours :(, so ya gotta bear with it
                                  – Andreas Wong
                                  May 25 '12 at 9:54






                                • 27




                                  There is a page for this topic in the GitHub wiki: github.com/mrdoob/three.js/wiki/How-to-run-things-locally
                                  – Felipe Lima
                                  May 29 '12 at 8:18






                                • 24




                                  You may also use the --allow-file-access-from-files switch in chrome. Per my answer here: stackoverflow.com/questions/8449716/…
                                  – prauchfuss
                                  Sep 8 '13 at 19:43

















                                up vote
                                691
                                down vote



                                accepted










                                My crystal ball says that you are loading the model using either file:// or C:/, which stays true to the error message as they are not http://



                                So you can either install a webserver in your local PC or upload the model somewhere else and use jsonp and change the url to http://example.com/path/to/model






                                share|improve this answer



















                                • 7




                                  Yeah, I'm trying to do this using file://, but I don't understand why this is permitted. Well, I'm installing Lampp I guess...
                                  – corazza
                                  May 25 '12 at 9:46






                                • 129




                                  Imagine if that is allowed and a webapp whereby the author of the page uses something like load('file://C:/users/user/supersecret.doc') and then upload the content to their server using ajax etc.
                                  – Andreas Wong
                                  May 25 '12 at 9:50






                                • 10




                                  unfortunately, policy is made for all cases, not only for yours :(, so ya gotta bear with it
                                  – Andreas Wong
                                  May 25 '12 at 9:54






                                • 27




                                  There is a page for this topic in the GitHub wiki: github.com/mrdoob/three.js/wiki/How-to-run-things-locally
                                  – Felipe Lima
                                  May 29 '12 at 8:18






                                • 24




                                  You may also use the --allow-file-access-from-files switch in chrome. Per my answer here: stackoverflow.com/questions/8449716/…
                                  – prauchfuss
                                  Sep 8 '13 at 19:43















                                up vote
                                691
                                down vote



                                accepted







                                up vote
                                691
                                down vote



                                accepted






                                My crystal ball says that you are loading the model using either file:// or C:/, which stays true to the error message as they are not http://



                                So you can either install a webserver in your local PC or upload the model somewhere else and use jsonp and change the url to http://example.com/path/to/model






                                share|improve this answer














                                My crystal ball says that you are loading the model using either file:// or C:/, which stays true to the error message as they are not http://



                                So you can either install a webserver in your local PC or upload the model somewhere else and use jsonp and change the url to http://example.com/path/to/model







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Feb 4 '14 at 2:21

























                                answered May 25 '12 at 9:42









                                Andreas Wong

                                46.8k1690116




                                46.8k1690116








                                • 7




                                  Yeah, I'm trying to do this using file://, but I don't understand why this is permitted. Well, I'm installing Lampp I guess...
                                  – corazza
                                  May 25 '12 at 9:46






                                • 129




                                  Imagine if that is allowed and a webapp whereby the author of the page uses something like load('file://C:/users/user/supersecret.doc') and then upload the content to their server using ajax etc.
                                  – Andreas Wong
                                  May 25 '12 at 9:50






                                • 10




                                  unfortunately, policy is made for all cases, not only for yours :(, so ya gotta bear with it
                                  – Andreas Wong
                                  May 25 '12 at 9:54






                                • 27




                                  There is a page for this topic in the GitHub wiki: github.com/mrdoob/three.js/wiki/How-to-run-things-locally
                                  – Felipe Lima
                                  May 29 '12 at 8:18






                                • 24




                                  You may also use the --allow-file-access-from-files switch in chrome. Per my answer here: stackoverflow.com/questions/8449716/…
                                  – prauchfuss
                                  Sep 8 '13 at 19:43
















                                • 7




                                  Yeah, I'm trying to do this using file://, but I don't understand why this is permitted. Well, I'm installing Lampp I guess...
                                  – corazza
                                  May 25 '12 at 9:46






                                • 129




                                  Imagine if that is allowed and a webapp whereby the author of the page uses something like load('file://C:/users/user/supersecret.doc') and then upload the content to their server using ajax etc.
                                  – Andreas Wong
                                  May 25 '12 at 9:50






                                • 10




                                  unfortunately, policy is made for all cases, not only for yours :(, so ya gotta bear with it
                                  – Andreas Wong
                                  May 25 '12 at 9:54






                                • 27




                                  There is a page for this topic in the GitHub wiki: github.com/mrdoob/three.js/wiki/How-to-run-things-locally
                                  – Felipe Lima
                                  May 29 '12 at 8:18






                                • 24




                                  You may also use the --allow-file-access-from-files switch in chrome. Per my answer here: stackoverflow.com/questions/8449716/…
                                  – prauchfuss
                                  Sep 8 '13 at 19:43










                                7




                                7




                                Yeah, I'm trying to do this using file://, but I don't understand why this is permitted. Well, I'm installing Lampp I guess...
                                – corazza
                                May 25 '12 at 9:46




                                Yeah, I'm trying to do this using file://, but I don't understand why this is permitted. Well, I'm installing Lampp I guess...
                                – corazza
                                May 25 '12 at 9:46




                                129




                                129




                                Imagine if that is allowed and a webapp whereby the author of the page uses something like load('file://C:/users/user/supersecret.doc') and then upload the content to their server using ajax etc.
                                – Andreas Wong
                                May 25 '12 at 9:50




                                Imagine if that is allowed and a webapp whereby the author of the page uses something like load('file://C:/users/user/supersecret.doc') and then upload the content to their server using ajax etc.
                                – Andreas Wong
                                May 25 '12 at 9:50




                                10




                                10




                                unfortunately, policy is made for all cases, not only for yours :(, so ya gotta bear with it
                                – Andreas Wong
                                May 25 '12 at 9:54




                                unfortunately, policy is made for all cases, not only for yours :(, so ya gotta bear with it
                                – Andreas Wong
                                May 25 '12 at 9:54




                                27




                                27




                                There is a page for this topic in the GitHub wiki: github.com/mrdoob/three.js/wiki/How-to-run-things-locally
                                – Felipe Lima
                                May 29 '12 at 8:18




                                There is a page for this topic in the GitHub wiki: github.com/mrdoob/three.js/wiki/How-to-run-things-locally
                                – Felipe Lima
                                May 29 '12 at 8:18




                                24




                                24




                                You may also use the --allow-file-access-from-files switch in chrome. Per my answer here: stackoverflow.com/questions/8449716/…
                                – prauchfuss
                                Sep 8 '13 at 19:43






                                You may also use the --allow-file-access-from-files switch in chrome. Per my answer here: stackoverflow.com/questions/8449716/…
                                – prauchfuss
                                Sep 8 '13 at 19:43














                                up vote
                                525
                                down vote













                                Just to be explicit - Yes, the error is saying you cannot point your browser directly at file://some/path/some.html



                                Here are some options to quickly spin up a local web server to let your browser render local files



                                Python 2



                                If you have Python installed...




                                1. Change directory into the folder where your file some.html or file(s) exist using the command cd /path/to/your/folder


                                2. Start up a Python web server using the command python -m SimpleHTTPServer



                                This will start a web server to host your entire directory listing at http://localhost:8000




                                1. You can use a custom port python -m SimpleHTTPServer 9000 giving you link: http://localhost:9000


                                This approach is built in to any Python installation.



                                Python 3



                                Do the same steps, but use the following command instead python3 -m http.server



                                Node.js



                                Alternatively, if you demand a more responsive setup and already use nodejs...




                                1. Install http-server by typing npm install -g http-server


                                2. Change into your working directory, where yoursome.html lives


                                3. Start your http server by issuing http-server -c-1



                                This spins up a Node.js httpd which serves the files in your directory as static files accessible from http://localhost:8080



                                Ruby



                                If your preferred language is Ruby ... the Ruby Gods say this works as well:



                                ruby -run -e httpd . -p 8080


                                PHP



                                Of course PHP also has its solution.



                                php -S localhost:8000





                                share|improve this answer



















                                • 3




                                  This saved me a ton of time thanks. My Python install didnt have the SimpleHTTPServer module but the node instructions worked like a charm.
                                  – LukeP
                                  Jul 25 '14 at 3:42






                                • 3




                                  In response to LukeP's comment, in python 2.7 the command does work as per the instructions $ python -m SimpleHTTPServer, which produces the message: Serving HTTP on 0.0.0.0 port 8000 ... If you spell the module name wrong, e.g. $ python -m SimpleHttpServer then you will get the error message No module named SimpleHttpServer You will get a similar error message if you have python3 installed (v. python 2.7). You can check your version of python using the command: $ python --version. You can also specify the port to listen on like this: $ python -m SimpleHTTPServer 3333
                                  – 7stud
                                  Nov 20 '14 at 1:06








                                • 1




                                  The python server serves up files from the directory where you start the server. So if the files you want to serve up are located in /Users/7stud/angular_projects/1app, then start the server in that directory, e.g. $ cd ~/angular_projects/1app, then $ python -m SimpleHTTPServer. In your browser enter the url http://localhost:8000/index.html. You can also request files in subdirectories of the directory where you started the server, e.g. http://localhost:8000/subdir/hello.html
                                  – 7stud
                                  Nov 20 '14 at 1:18






                                • 2




                                  I've heard that Python is simple and powerful, just like "X" language, but this is ridiculous! No need to install XAMPP, or setup a simple http server js with node to serve static files - One command and boom! Thank you very much, saves a LOT of time and hassle.
                                  – R.D.
                                  May 31 '16 at 17:59






                                • 1




                                  AWESOME! - for Python on Windows use: python -m http.server 8080 ...or whatever port you want and when you want to quit it just ctrl-c.
                                  – Kristopher
                                  Oct 19 '16 at 15:37















                                up vote
                                525
                                down vote













                                Just to be explicit - Yes, the error is saying you cannot point your browser directly at file://some/path/some.html



                                Here are some options to quickly spin up a local web server to let your browser render local files



                                Python 2



                                If you have Python installed...




                                1. Change directory into the folder where your file some.html or file(s) exist using the command cd /path/to/your/folder


                                2. Start up a Python web server using the command python -m SimpleHTTPServer



                                This will start a web server to host your entire directory listing at http://localhost:8000




                                1. You can use a custom port python -m SimpleHTTPServer 9000 giving you link: http://localhost:9000


                                This approach is built in to any Python installation.



                                Python 3



                                Do the same steps, but use the following command instead python3 -m http.server



                                Node.js



                                Alternatively, if you demand a more responsive setup and already use nodejs...




                                1. Install http-server by typing npm install -g http-server


                                2. Change into your working directory, where yoursome.html lives


                                3. Start your http server by issuing http-server -c-1



                                This spins up a Node.js httpd which serves the files in your directory as static files accessible from http://localhost:8080



                                Ruby



                                If your preferred language is Ruby ... the Ruby Gods say this works as well:



                                ruby -run -e httpd . -p 8080


                                PHP



                                Of course PHP also has its solution.



                                php -S localhost:8000





                                share|improve this answer



















                                • 3




                                  This saved me a ton of time thanks. My Python install didnt have the SimpleHTTPServer module but the node instructions worked like a charm.
                                  – LukeP
                                  Jul 25 '14 at 3:42






                                • 3




                                  In response to LukeP's comment, in python 2.7 the command does work as per the instructions $ python -m SimpleHTTPServer, which produces the message: Serving HTTP on 0.0.0.0 port 8000 ... If you spell the module name wrong, e.g. $ python -m SimpleHttpServer then you will get the error message No module named SimpleHttpServer You will get a similar error message if you have python3 installed (v. python 2.7). You can check your version of python using the command: $ python --version. You can also specify the port to listen on like this: $ python -m SimpleHTTPServer 3333
                                  – 7stud
                                  Nov 20 '14 at 1:06








                                • 1




                                  The python server serves up files from the directory where you start the server. So if the files you want to serve up are located in /Users/7stud/angular_projects/1app, then start the server in that directory, e.g. $ cd ~/angular_projects/1app, then $ python -m SimpleHTTPServer. In your browser enter the url http://localhost:8000/index.html. You can also request files in subdirectories of the directory where you started the server, e.g. http://localhost:8000/subdir/hello.html
                                  – 7stud
                                  Nov 20 '14 at 1:18






                                • 2




                                  I've heard that Python is simple and powerful, just like "X" language, but this is ridiculous! No need to install XAMPP, or setup a simple http server js with node to serve static files - One command and boom! Thank you very much, saves a LOT of time and hassle.
                                  – R.D.
                                  May 31 '16 at 17:59






                                • 1




                                  AWESOME! - for Python on Windows use: python -m http.server 8080 ...or whatever port you want and when you want to quit it just ctrl-c.
                                  – Kristopher
                                  Oct 19 '16 at 15:37













                                up vote
                                525
                                down vote










                                up vote
                                525
                                down vote









                                Just to be explicit - Yes, the error is saying you cannot point your browser directly at file://some/path/some.html



                                Here are some options to quickly spin up a local web server to let your browser render local files



                                Python 2



                                If you have Python installed...




                                1. Change directory into the folder where your file some.html or file(s) exist using the command cd /path/to/your/folder


                                2. Start up a Python web server using the command python -m SimpleHTTPServer



                                This will start a web server to host your entire directory listing at http://localhost:8000




                                1. You can use a custom port python -m SimpleHTTPServer 9000 giving you link: http://localhost:9000


                                This approach is built in to any Python installation.



                                Python 3



                                Do the same steps, but use the following command instead python3 -m http.server



                                Node.js



                                Alternatively, if you demand a more responsive setup and already use nodejs...




                                1. Install http-server by typing npm install -g http-server


                                2. Change into your working directory, where yoursome.html lives


                                3. Start your http server by issuing http-server -c-1



                                This spins up a Node.js httpd which serves the files in your directory as static files accessible from http://localhost:8080



                                Ruby



                                If your preferred language is Ruby ... the Ruby Gods say this works as well:



                                ruby -run -e httpd . -p 8080


                                PHP



                                Of course PHP also has its solution.



                                php -S localhost:8000





                                share|improve this answer














                                Just to be explicit - Yes, the error is saying you cannot point your browser directly at file://some/path/some.html



                                Here are some options to quickly spin up a local web server to let your browser render local files



                                Python 2



                                If you have Python installed...




                                1. Change directory into the folder where your file some.html or file(s) exist using the command cd /path/to/your/folder


                                2. Start up a Python web server using the command python -m SimpleHTTPServer



                                This will start a web server to host your entire directory listing at http://localhost:8000




                                1. You can use a custom port python -m SimpleHTTPServer 9000 giving you link: http://localhost:9000


                                This approach is built in to any Python installation.



                                Python 3



                                Do the same steps, but use the following command instead python3 -m http.server



                                Node.js



                                Alternatively, if you demand a more responsive setup and already use nodejs...




                                1. Install http-server by typing npm install -g http-server


                                2. Change into your working directory, where yoursome.html lives


                                3. Start your http server by issuing http-server -c-1



                                This spins up a Node.js httpd which serves the files in your directory as static files accessible from http://localhost:8080



                                Ruby



                                If your preferred language is Ruby ... the Ruby Gods say this works as well:



                                ruby -run -e httpd . -p 8080


                                PHP



                                Of course PHP also has its solution.



                                php -S localhost:8000






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Jul 26 at 11:58

























                                answered Feb 6 '14 at 16:36









                                Scott Stensland

                                15.5k75471




                                15.5k75471








                                • 3




                                  This saved me a ton of time thanks. My Python install didnt have the SimpleHTTPServer module but the node instructions worked like a charm.
                                  – LukeP
                                  Jul 25 '14 at 3:42






                                • 3




                                  In response to LukeP's comment, in python 2.7 the command does work as per the instructions $ python -m SimpleHTTPServer, which produces the message: Serving HTTP on 0.0.0.0 port 8000 ... If you spell the module name wrong, e.g. $ python -m SimpleHttpServer then you will get the error message No module named SimpleHttpServer You will get a similar error message if you have python3 installed (v. python 2.7). You can check your version of python using the command: $ python --version. You can also specify the port to listen on like this: $ python -m SimpleHTTPServer 3333
                                  – 7stud
                                  Nov 20 '14 at 1:06








                                • 1




                                  The python server serves up files from the directory where you start the server. So if the files you want to serve up are located in /Users/7stud/angular_projects/1app, then start the server in that directory, e.g. $ cd ~/angular_projects/1app, then $ python -m SimpleHTTPServer. In your browser enter the url http://localhost:8000/index.html. You can also request files in subdirectories of the directory where you started the server, e.g. http://localhost:8000/subdir/hello.html
                                  – 7stud
                                  Nov 20 '14 at 1:18






                                • 2




                                  I've heard that Python is simple and powerful, just like "X" language, but this is ridiculous! No need to install XAMPP, or setup a simple http server js with node to serve static files - One command and boom! Thank you very much, saves a LOT of time and hassle.
                                  – R.D.
                                  May 31 '16 at 17:59






                                • 1




                                  AWESOME! - for Python on Windows use: python -m http.server 8080 ...or whatever port you want and when you want to quit it just ctrl-c.
                                  – Kristopher
                                  Oct 19 '16 at 15:37














                                • 3




                                  This saved me a ton of time thanks. My Python install didnt have the SimpleHTTPServer module but the node instructions worked like a charm.
                                  – LukeP
                                  Jul 25 '14 at 3:42






                                • 3




                                  In response to LukeP's comment, in python 2.7 the command does work as per the instructions $ python -m SimpleHTTPServer, which produces the message: Serving HTTP on 0.0.0.0 port 8000 ... If you spell the module name wrong, e.g. $ python -m SimpleHttpServer then you will get the error message No module named SimpleHttpServer You will get a similar error message if you have python3 installed (v. python 2.7). You can check your version of python using the command: $ python --version. You can also specify the port to listen on like this: $ python -m SimpleHTTPServer 3333
                                  – 7stud
                                  Nov 20 '14 at 1:06








                                • 1




                                  The python server serves up files from the directory where you start the server. So if the files you want to serve up are located in /Users/7stud/angular_projects/1app, then start the server in that directory, e.g. $ cd ~/angular_projects/1app, then $ python -m SimpleHTTPServer. In your browser enter the url http://localhost:8000/index.html. You can also request files in subdirectories of the directory where you started the server, e.g. http://localhost:8000/subdir/hello.html
                                  – 7stud
                                  Nov 20 '14 at 1:18






                                • 2




                                  I've heard that Python is simple and powerful, just like "X" language, but this is ridiculous! No need to install XAMPP, or setup a simple http server js with node to serve static files - One command and boom! Thank you very much, saves a LOT of time and hassle.
                                  – R.D.
                                  May 31 '16 at 17:59






                                • 1




                                  AWESOME! - for Python on Windows use: python -m http.server 8080 ...or whatever port you want and when you want to quit it just ctrl-c.
                                  – Kristopher
                                  Oct 19 '16 at 15:37








                                3




                                3




                                This saved me a ton of time thanks. My Python install didnt have the SimpleHTTPServer module but the node instructions worked like a charm.
                                – LukeP
                                Jul 25 '14 at 3:42




                                This saved me a ton of time thanks. My Python install didnt have the SimpleHTTPServer module but the node instructions worked like a charm.
                                – LukeP
                                Jul 25 '14 at 3:42




                                3




                                3




                                In response to LukeP's comment, in python 2.7 the command does work as per the instructions $ python -m SimpleHTTPServer, which produces the message: Serving HTTP on 0.0.0.0 port 8000 ... If you spell the module name wrong, e.g. $ python -m SimpleHttpServer then you will get the error message No module named SimpleHttpServer You will get a similar error message if you have python3 installed (v. python 2.7). You can check your version of python using the command: $ python --version. You can also specify the port to listen on like this: $ python -m SimpleHTTPServer 3333
                                – 7stud
                                Nov 20 '14 at 1:06






                                In response to LukeP's comment, in python 2.7 the command does work as per the instructions $ python -m SimpleHTTPServer, which produces the message: Serving HTTP on 0.0.0.0 port 8000 ... If you spell the module name wrong, e.g. $ python -m SimpleHttpServer then you will get the error message No module named SimpleHttpServer You will get a similar error message if you have python3 installed (v. python 2.7). You can check your version of python using the command: $ python --version. You can also specify the port to listen on like this: $ python -m SimpleHTTPServer 3333
                                – 7stud
                                Nov 20 '14 at 1:06






                                1




                                1




                                The python server serves up files from the directory where you start the server. So if the files you want to serve up are located in /Users/7stud/angular_projects/1app, then start the server in that directory, e.g. $ cd ~/angular_projects/1app, then $ python -m SimpleHTTPServer. In your browser enter the url http://localhost:8000/index.html. You can also request files in subdirectories of the directory where you started the server, e.g. http://localhost:8000/subdir/hello.html
                                – 7stud
                                Nov 20 '14 at 1:18




                                The python server serves up files from the directory where you start the server. So if the files you want to serve up are located in /Users/7stud/angular_projects/1app, then start the server in that directory, e.g. $ cd ~/angular_projects/1app, then $ python -m SimpleHTTPServer. In your browser enter the url http://localhost:8000/index.html. You can also request files in subdirectories of the directory where you started the server, e.g. http://localhost:8000/subdir/hello.html
                                – 7stud
                                Nov 20 '14 at 1:18




                                2




                                2




                                I've heard that Python is simple and powerful, just like "X" language, but this is ridiculous! No need to install XAMPP, or setup a simple http server js with node to serve static files - One command and boom! Thank you very much, saves a LOT of time and hassle.
                                – R.D.
                                May 31 '16 at 17:59




                                I've heard that Python is simple and powerful, just like "X" language, but this is ridiculous! No need to install XAMPP, or setup a simple http server js with node to serve static files - One command and boom! Thank you very much, saves a LOT of time and hassle.
                                – R.D.
                                May 31 '16 at 17:59




                                1




                                1




                                AWESOME! - for Python on Windows use: python -m http.server 8080 ...or whatever port you want and when you want to quit it just ctrl-c.
                                – Kristopher
                                Oct 19 '16 at 15:37




                                AWESOME! - for Python on Windows use: python -m http.server 8080 ...or whatever port you want and when you want to quit it just ctrl-c.
                                – Kristopher
                                Oct 19 '16 at 15:37










                                up vote
                                148
                                down vote













                                In Chrome you can use this flag:



                                --allow-file-access-from-files


                                Read more here.






                                share|improve this answer























                                • This does not work for coffee-script issue.
                                  – Blairg23
                                  Oct 14 '14 at 5:03






                                • 10




                                  @Blairg23, keep in mind that this solution requires restarting all instances of Chrome.exe for it to work
                                  – Alex Klaus
                                  Jun 16 '15 at 23:41






                                • 3




                                  Please, explain how to use it in chrome.
                                  – Rishabh Agrahari
                                  Aug 28 '17 at 8:12










                                • @Priya Should not do this though
                                  – Suraj Jain
                                  Dec 17 '17 at 6:12










                                • I would suggest using Chromium only for local debugging (starting it with flag --allow-file-access-from-files). It means using Chrome for common web browsing, and use Chromium as the default application for HTML file.
                                  – Alan Zhiliang Feng
                                  May 14 at 11:23















                                up vote
                                148
                                down vote













                                In Chrome you can use this flag:



                                --allow-file-access-from-files


                                Read more here.






                                share|improve this answer























                                • This does not work for coffee-script issue.
                                  – Blairg23
                                  Oct 14 '14 at 5:03






                                • 10




                                  @Blairg23, keep in mind that this solution requires restarting all instances of Chrome.exe for it to work
                                  – Alex Klaus
                                  Jun 16 '15 at 23:41






                                • 3




                                  Please, explain how to use it in chrome.
                                  – Rishabh Agrahari
                                  Aug 28 '17 at 8:12










                                • @Priya Should not do this though
                                  – Suraj Jain
                                  Dec 17 '17 at 6:12










                                • I would suggest using Chromium only for local debugging (starting it with flag --allow-file-access-from-files). It means using Chrome for common web browsing, and use Chromium as the default application for HTML file.
                                  – Alan Zhiliang Feng
                                  May 14 at 11:23













                                up vote
                                148
                                down vote










                                up vote
                                148
                                down vote









                                In Chrome you can use this flag:



                                --allow-file-access-from-files


                                Read more here.






                                share|improve this answer














                                In Chrome you can use this flag:



                                --allow-file-access-from-files


                                Read more here.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited May 23 '17 at 10:31









                                Community

                                11




                                11










                                answered May 20 '14 at 11:36







                                user669677



















                                • This does not work for coffee-script issue.
                                  – Blairg23
                                  Oct 14 '14 at 5:03






                                • 10




                                  @Blairg23, keep in mind that this solution requires restarting all instances of Chrome.exe for it to work
                                  – Alex Klaus
                                  Jun 16 '15 at 23:41






                                • 3




                                  Please, explain how to use it in chrome.
                                  – Rishabh Agrahari
                                  Aug 28 '17 at 8:12










                                • @Priya Should not do this though
                                  – Suraj Jain
                                  Dec 17 '17 at 6:12










                                • I would suggest using Chromium only for local debugging (starting it with flag --allow-file-access-from-files). It means using Chrome for common web browsing, and use Chromium as the default application for HTML file.
                                  – Alan Zhiliang Feng
                                  May 14 at 11:23


















                                • This does not work for coffee-script issue.
                                  – Blairg23
                                  Oct 14 '14 at 5:03






                                • 10




                                  @Blairg23, keep in mind that this solution requires restarting all instances of Chrome.exe for it to work
                                  – Alex Klaus
                                  Jun 16 '15 at 23:41






                                • 3




                                  Please, explain how to use it in chrome.
                                  – Rishabh Agrahari
                                  Aug 28 '17 at 8:12










                                • @Priya Should not do this though
                                  – Suraj Jain
                                  Dec 17 '17 at 6:12










                                • I would suggest using Chromium only for local debugging (starting it with flag --allow-file-access-from-files). It means using Chrome for common web browsing, and use Chromium as the default application for HTML file.
                                  – Alan Zhiliang Feng
                                  May 14 at 11:23
















                                This does not work for coffee-script issue.
                                – Blairg23
                                Oct 14 '14 at 5:03




                                This does not work for coffee-script issue.
                                – Blairg23
                                Oct 14 '14 at 5:03




                                10




                                10




                                @Blairg23, keep in mind that this solution requires restarting all instances of Chrome.exe for it to work
                                – Alex Klaus
                                Jun 16 '15 at 23:41




                                @Blairg23, keep in mind that this solution requires restarting all instances of Chrome.exe for it to work
                                – Alex Klaus
                                Jun 16 '15 at 23:41




                                3




                                3




                                Please, explain how to use it in chrome.
                                – Rishabh Agrahari
                                Aug 28 '17 at 8:12




                                Please, explain how to use it in chrome.
                                – Rishabh Agrahari
                                Aug 28 '17 at 8:12












                                @Priya Should not do this though
                                – Suraj Jain
                                Dec 17 '17 at 6:12




                                @Priya Should not do this though
                                – Suraj Jain
                                Dec 17 '17 at 6:12












                                I would suggest using Chromium only for local debugging (starting it with flag --allow-file-access-from-files). It means using Chrome for common web browsing, and use Chromium as the default application for HTML file.
                                – Alan Zhiliang Feng
                                May 14 at 11:23




                                I would suggest using Chromium only for local debugging (starting it with flag --allow-file-access-from-files). It means using Chrome for common web browsing, and use Chromium as the default application for HTML file.
                                – Alan Zhiliang Feng
                                May 14 at 11:23










                                up vote
                                53
                                down vote













                                Ran in to this today.



                                I wrote some code that looked like this:



                                app.controller('ctrlr', function($scope, $http){
                                $http.get('localhost:3000').success(function(data) {
                                $scope.stuff = data;
                                });
                                });


                                ...but it should've looked like this:



                                app.controller('ctrlr', function($scope, $http){
                                $http.get('http://localhost:3000').success(function(data) {
                                $scope.stuff = data;
                                });
                                });


                                The only difference was the lack of http:// in the second snippet of code.



                                Just wanted to put that out there in case there are others with a similar issue.






                                share|improve this answer



























                                  up vote
                                  53
                                  down vote













                                  Ran in to this today.



                                  I wrote some code that looked like this:



                                  app.controller('ctrlr', function($scope, $http){
                                  $http.get('localhost:3000').success(function(data) {
                                  $scope.stuff = data;
                                  });
                                  });


                                  ...but it should've looked like this:



                                  app.controller('ctrlr', function($scope, $http){
                                  $http.get('http://localhost:3000').success(function(data) {
                                  $scope.stuff = data;
                                  });
                                  });


                                  The only difference was the lack of http:// in the second snippet of code.



                                  Just wanted to put that out there in case there are others with a similar issue.






                                  share|improve this answer

























                                    up vote
                                    53
                                    down vote










                                    up vote
                                    53
                                    down vote









                                    Ran in to this today.



                                    I wrote some code that looked like this:



                                    app.controller('ctrlr', function($scope, $http){
                                    $http.get('localhost:3000').success(function(data) {
                                    $scope.stuff = data;
                                    });
                                    });


                                    ...but it should've looked like this:



                                    app.controller('ctrlr', function($scope, $http){
                                    $http.get('http://localhost:3000').success(function(data) {
                                    $scope.stuff = data;
                                    });
                                    });


                                    The only difference was the lack of http:// in the second snippet of code.



                                    Just wanted to put that out there in case there are others with a similar issue.






                                    share|improve this answer














                                    Ran in to this today.



                                    I wrote some code that looked like this:



                                    app.controller('ctrlr', function($scope, $http){
                                    $http.get('localhost:3000').success(function(data) {
                                    $scope.stuff = data;
                                    });
                                    });


                                    ...but it should've looked like this:



                                    app.controller('ctrlr', function($scope, $http){
                                    $http.get('http://localhost:3000').success(function(data) {
                                    $scope.stuff = data;
                                    });
                                    });


                                    The only difference was the lack of http:// in the second snippet of code.



                                    Just wanted to put that out there in case there are others with a similar issue.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Feb 20 '14 at 17:22









                                    corazza

                                    12.1k2989161




                                    12.1k2989161










                                    answered Feb 20 '14 at 16:27









                                    James Harrington

                                    2,1972027




                                    2,1972027






















                                        up vote
                                        28
                                        down vote













                                        Just change the url to http://localhost instead of localhost. If you open the html file from local, you should create a local server to serve that html file, the simplest way is using Web Server for Chrome. That will fix the issue.






                                        share|improve this answer



















                                        • 2




                                          +1 for Web Server for Chrome app link - it's by far the simplest & cleanest solution for temporary httpd setup for Chrome IMO
                                          – vaxquis
                                          Jul 8 '17 at 13:08















                                        up vote
                                        28
                                        down vote













                                        Just change the url to http://localhost instead of localhost. If you open the html file from local, you should create a local server to serve that html file, the simplest way is using Web Server for Chrome. That will fix the issue.






                                        share|improve this answer



















                                        • 2




                                          +1 for Web Server for Chrome app link - it's by far the simplest & cleanest solution for temporary httpd setup for Chrome IMO
                                          – vaxquis
                                          Jul 8 '17 at 13:08













                                        up vote
                                        28
                                        down vote










                                        up vote
                                        28
                                        down vote









                                        Just change the url to http://localhost instead of localhost. If you open the html file from local, you should create a local server to serve that html file, the simplest way is using Web Server for Chrome. That will fix the issue.






                                        share|improve this answer














                                        Just change the url to http://localhost instead of localhost. If you open the html file from local, you should create a local server to serve that html file, the simplest way is using Web Server for Chrome. That will fix the issue.







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Jul 8 '17 at 13:08









                                        vaxquis

                                        7,44453657




                                        7,44453657










                                        answered Dec 16 '16 at 3:01









                                        Finn

                                        1,85811420




                                        1,85811420








                                        • 2




                                          +1 for Web Server for Chrome app link - it's by far the simplest & cleanest solution for temporary httpd setup for Chrome IMO
                                          – vaxquis
                                          Jul 8 '17 at 13:08














                                        • 2




                                          +1 for Web Server for Chrome app link - it's by far the simplest & cleanest solution for temporary httpd setup for Chrome IMO
                                          – vaxquis
                                          Jul 8 '17 at 13:08








                                        2




                                        2




                                        +1 for Web Server for Chrome app link - it's by far the simplest & cleanest solution for temporary httpd setup for Chrome IMO
                                        – vaxquis
                                        Jul 8 '17 at 13:08




                                        +1 for Web Server for Chrome app link - it's by far the simplest & cleanest solution for temporary httpd setup for Chrome IMO
                                        – vaxquis
                                        Jul 8 '17 at 13:08










                                        up vote
                                        13
                                        down vote













                                        In an Android app — for example, to allow JavaScript to have access to assets via file:///android_asset/ — use setAllowFileAccessFromFileURLs(true) on the WebSettings that you get from calling getSettings() on the WebView.






                                        share|improve this answer





















                                        • Brilliant! We were just about to rewrite methods to inject JSON into variables .. but this works! webView.getSettings().setAllowFileAccessFromFileURLs(true);
                                          – WallyHale
                                          Aug 17 '17 at 8:54















                                        up vote
                                        13
                                        down vote













                                        In an Android app — for example, to allow JavaScript to have access to assets via file:///android_asset/ — use setAllowFileAccessFromFileURLs(true) on the WebSettings that you get from calling getSettings() on the WebView.






                                        share|improve this answer





















                                        • Brilliant! We were just about to rewrite methods to inject JSON into variables .. but this works! webView.getSettings().setAllowFileAccessFromFileURLs(true);
                                          – WallyHale
                                          Aug 17 '17 at 8:54













                                        up vote
                                        13
                                        down vote










                                        up vote
                                        13
                                        down vote









                                        In an Android app — for example, to allow JavaScript to have access to assets via file:///android_asset/ — use setAllowFileAccessFromFileURLs(true) on the WebSettings that you get from calling getSettings() on the WebView.






                                        share|improve this answer












                                        In an Android app — for example, to allow JavaScript to have access to assets via file:///android_asset/ — use setAllowFileAccessFromFileURLs(true) on the WebSettings that you get from calling getSettings() on the WebView.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Dec 29 '16 at 22:15









                                        CommonsWare

                                        761k13818531905




                                        761k13818531905












                                        • Brilliant! We were just about to rewrite methods to inject JSON into variables .. but this works! webView.getSettings().setAllowFileAccessFromFileURLs(true);
                                          – WallyHale
                                          Aug 17 '17 at 8:54


















                                        • Brilliant! We were just about to rewrite methods to inject JSON into variables .. but this works! webView.getSettings().setAllowFileAccessFromFileURLs(true);
                                          – WallyHale
                                          Aug 17 '17 at 8:54
















                                        Brilliant! We were just about to rewrite methods to inject JSON into variables .. but this works! webView.getSettings().setAllowFileAccessFromFileURLs(true);
                                        – WallyHale
                                        Aug 17 '17 at 8:54




                                        Brilliant! We were just about to rewrite methods to inject JSON into variables .. but this works! webView.getSettings().setAllowFileAccessFromFileURLs(true);
                                        – WallyHale
                                        Aug 17 '17 at 8:54










                                        up vote
                                        10
                                        down vote













                                        For those on Windows without Python or Node.js, there is still a lightweight solution: Mongoose.



                                        All you do is drag the executable to wherever the root of the server should be, and run it. An icon will appear in the taskbar and it'll navigate to the server in the default browser.



                                        Also, Z-WAMP is a 100% portable WAMP that runs in a single folder, it's awesome. That's an option if you need a quick PHP and MySQL server.






                                        share|improve this answer























                                        • If you install php or you have installed, you can start a server in your folder: php.net/manual/es/features.commandline.webserver.php
                                          – jechaviz
                                          Jun 15 '16 at 21:14















                                        up vote
                                        10
                                        down vote













                                        For those on Windows without Python or Node.js, there is still a lightweight solution: Mongoose.



                                        All you do is drag the executable to wherever the root of the server should be, and run it. An icon will appear in the taskbar and it'll navigate to the server in the default browser.



                                        Also, Z-WAMP is a 100% portable WAMP that runs in a single folder, it's awesome. That's an option if you need a quick PHP and MySQL server.






                                        share|improve this answer























                                        • If you install php or you have installed, you can start a server in your folder: php.net/manual/es/features.commandline.webserver.php
                                          – jechaviz
                                          Jun 15 '16 at 21:14













                                        up vote
                                        10
                                        down vote










                                        up vote
                                        10
                                        down vote









                                        For those on Windows without Python or Node.js, there is still a lightweight solution: Mongoose.



                                        All you do is drag the executable to wherever the root of the server should be, and run it. An icon will appear in the taskbar and it'll navigate to the server in the default browser.



                                        Also, Z-WAMP is a 100% portable WAMP that runs in a single folder, it's awesome. That's an option if you need a quick PHP and MySQL server.






                                        share|improve this answer














                                        For those on Windows without Python or Node.js, there is still a lightweight solution: Mongoose.



                                        All you do is drag the executable to wherever the root of the server should be, and run it. An icon will appear in the taskbar and it'll navigate to the server in the default browser.



                                        Also, Z-WAMP is a 100% portable WAMP that runs in a single folder, it's awesome. That's an option if you need a quick PHP and MySQL server.







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Jan 28 '16 at 2:33

























                                        answered Mar 4 '15 at 5:24









                                        bryc

                                        2,34022240




                                        2,34022240












                                        • If you install php or you have installed, you can start a server in your folder: php.net/manual/es/features.commandline.webserver.php
                                          – jechaviz
                                          Jun 15 '16 at 21:14


















                                        • If you install php or you have installed, you can start a server in your folder: php.net/manual/es/features.commandline.webserver.php
                                          – jechaviz
                                          Jun 15 '16 at 21:14
















                                        If you install php or you have installed, you can start a server in your folder: php.net/manual/es/features.commandline.webserver.php
                                        – jechaviz
                                        Jun 15 '16 at 21:14




                                        If you install php or you have installed, you can start a server in your folder: php.net/manual/es/features.commandline.webserver.php
                                        – jechaviz
                                        Jun 15 '16 at 21:14










                                        up vote
                                        8
                                        down vote













                                        If you use Mozilla Firefox, It will work as expected without any issues;



                                        P.S. Even IE_Edge works fine, surprisingly!!






                                        share|improve this answer



























                                          up vote
                                          8
                                          down vote













                                          If you use Mozilla Firefox, It will work as expected without any issues;



                                          P.S. Even IE_Edge works fine, surprisingly!!






                                          share|improve this answer

























                                            up vote
                                            8
                                            down vote










                                            up vote
                                            8
                                            down vote









                                            If you use Mozilla Firefox, It will work as expected without any issues;



                                            P.S. Even IE_Edge works fine, surprisingly!!






                                            share|improve this answer














                                            If you use Mozilla Firefox, It will work as expected without any issues;



                                            P.S. Even IE_Edge works fine, surprisingly!!







                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited Apr 6 at 22:05

























                                            answered Apr 2 at 17:00









                                            Yash P Shah

                                            379312




                                            379312






















                                                up vote
                                                7
                                                down vote













                                                I'm going to list 3 different approaches to solve this issue:





                                                1. Using a very lightweight npm package: Install live-server using npm install -g live-server. Then, go to that directory open the terminal and type live-server and hit enter, page will be served at localhost:8080. BONUS: It also supports hot reloading by default.


                                                2. Using a lightweight Google Chrome app developed by Google: Install the app then, go to the apps tab in Chrome and open the app. In the app point it to the right folder. Your page will be served!


                                                3. Modifying Chrome shortcut in windows: Create a Chrome browser's shortcut. Right-click on the icon and open properties. In properties, edit target to "C:Program Files (x86)GoogleChromeApplicationchrome.exe" --disable-web-security --user-data-dir="C:/ChromeDevSession" and save. Then using Chrome open the page using ctrl+o. NOTE: Do NOT use this shortcut for regular browsing.






                                                share|improve this answer



























                                                  up vote
                                                  7
                                                  down vote













                                                  I'm going to list 3 different approaches to solve this issue:





                                                  1. Using a very lightweight npm package: Install live-server using npm install -g live-server. Then, go to that directory open the terminal and type live-server and hit enter, page will be served at localhost:8080. BONUS: It also supports hot reloading by default.


                                                  2. Using a lightweight Google Chrome app developed by Google: Install the app then, go to the apps tab in Chrome and open the app. In the app point it to the right folder. Your page will be served!


                                                  3. Modifying Chrome shortcut in windows: Create a Chrome browser's shortcut. Right-click on the icon and open properties. In properties, edit target to "C:Program Files (x86)GoogleChromeApplicationchrome.exe" --disable-web-security --user-data-dir="C:/ChromeDevSession" and save. Then using Chrome open the page using ctrl+o. NOTE: Do NOT use this shortcut for regular browsing.






                                                  share|improve this answer

























                                                    up vote
                                                    7
                                                    down vote










                                                    up vote
                                                    7
                                                    down vote









                                                    I'm going to list 3 different approaches to solve this issue:





                                                    1. Using a very lightweight npm package: Install live-server using npm install -g live-server. Then, go to that directory open the terminal and type live-server and hit enter, page will be served at localhost:8080. BONUS: It also supports hot reloading by default.


                                                    2. Using a lightweight Google Chrome app developed by Google: Install the app then, go to the apps tab in Chrome and open the app. In the app point it to the right folder. Your page will be served!


                                                    3. Modifying Chrome shortcut in windows: Create a Chrome browser's shortcut. Right-click on the icon and open properties. In properties, edit target to "C:Program Files (x86)GoogleChromeApplicationchrome.exe" --disable-web-security --user-data-dir="C:/ChromeDevSession" and save. Then using Chrome open the page using ctrl+o. NOTE: Do NOT use this shortcut for regular browsing.






                                                    share|improve this answer














                                                    I'm going to list 3 different approaches to solve this issue:





                                                    1. Using a very lightweight npm package: Install live-server using npm install -g live-server. Then, go to that directory open the terminal and type live-server and hit enter, page will be served at localhost:8080. BONUS: It also supports hot reloading by default.


                                                    2. Using a lightweight Google Chrome app developed by Google: Install the app then, go to the apps tab in Chrome and open the app. In the app point it to the right folder. Your page will be served!


                                                    3. Modifying Chrome shortcut in windows: Create a Chrome browser's shortcut. Right-click on the icon and open properties. In properties, edit target to "C:Program Files (x86)GoogleChromeApplicationchrome.exe" --disable-web-security --user-data-dir="C:/ChromeDevSession" and save. Then using Chrome open the page using ctrl+o. NOTE: Do NOT use this shortcut for regular browsing.







                                                    share|improve this answer














                                                    share|improve this answer



                                                    share|improve this answer








                                                    edited Jul 16 at 10:35

























                                                    answered Nov 29 '17 at 6:54









                                                    BlackBeard

                                                    4,77442137




                                                    4,77442137






















                                                        up vote
                                                        2
                                                        down vote













                                                        I was getting this exact error when loading an HTML file on the browser that was using a json file from the local directory. In my case, I was able to solve this by creating a simple node server that allowed to server static content. I left the code for this at this other answer.






                                                        share|improve this answer



























                                                          up vote
                                                          2
                                                          down vote













                                                          I was getting this exact error when loading an HTML file on the browser that was using a json file from the local directory. In my case, I was able to solve this by creating a simple node server that allowed to server static content. I left the code for this at this other answer.






                                                          share|improve this answer

























                                                            up vote
                                                            2
                                                            down vote










                                                            up vote
                                                            2
                                                            down vote









                                                            I was getting this exact error when loading an HTML file on the browser that was using a json file from the local directory. In my case, I was able to solve this by creating a simple node server that allowed to server static content. I left the code for this at this other answer.






                                                            share|improve this answer














                                                            I was getting this exact error when loading an HTML file on the browser that was using a json file from the local directory. In my case, I was able to solve this by creating a simple node server that allowed to server static content. I left the code for this at this other answer.







                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited May 23 '17 at 10:31









                                                            Community

                                                            11




                                                            11










                                                            answered Nov 10 '14 at 14:14









                                                            thehme

                                                            90511119




                                                            90511119






















                                                                up vote
                                                                2
                                                                down vote













                                                                I suggest you use a mini-server to run these kind of applications on localhost (if you are not using some inbuilt server).



                                                                Here's one that is very simple to setup and run:



                                                                https://www.npmjs.com/package/tiny-server





                                                                share|improve this answer

























                                                                  up vote
                                                                  2
                                                                  down vote













                                                                  I suggest you use a mini-server to run these kind of applications on localhost (if you are not using some inbuilt server).



                                                                  Here's one that is very simple to setup and run:



                                                                  https://www.npmjs.com/package/tiny-server





                                                                  share|improve this answer























                                                                    up vote
                                                                    2
                                                                    down vote










                                                                    up vote
                                                                    2
                                                                    down vote









                                                                    I suggest you use a mini-server to run these kind of applications on localhost (if you are not using some inbuilt server).



                                                                    Here's one that is very simple to setup and run:



                                                                    https://www.npmjs.com/package/tiny-server





                                                                    share|improve this answer












                                                                    I suggest you use a mini-server to run these kind of applications on localhost (if you are not using some inbuilt server).



                                                                    Here's one that is very simple to setup and run:



                                                                    https://www.npmjs.com/package/tiny-server






                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Aug 21 '17 at 11:15









                                                                    Deniss M.

                                                                    1,05322044




                                                                    1,05322044






















                                                                        up vote
                                                                        2
                                                                        down vote













                                                                        Use http:// or https:// to create url



                                                                        error: localhost:8080



                                                                        solution: http://localhost:8080






                                                                        share|improve this answer

























                                                                          up vote
                                                                          2
                                                                          down vote













                                                                          Use http:// or https:// to create url



                                                                          error: localhost:8080



                                                                          solution: http://localhost:8080






                                                                          share|improve this answer























                                                                            up vote
                                                                            2
                                                                            down vote










                                                                            up vote
                                                                            2
                                                                            down vote









                                                                            Use http:// or https:// to create url



                                                                            error: localhost:8080



                                                                            solution: http://localhost:8080






                                                                            share|improve this answer












                                                                            Use http:// or https:// to create url



                                                                            error: localhost:8080



                                                                            solution: http://localhost:8080







                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered Oct 12 at 3:11









                                                                            KARTHIKEYAN.A

                                                                            4,80733854




                                                                            4,80733854






















                                                                                up vote
                                                                                1
                                                                                down vote













                                                                                It simply says that the application should be run on a web server. I had the same problem with chrome, I started tomcat and moved my application there, and it worked.






                                                                                share|improve this answer

























                                                                                  up vote
                                                                                  1
                                                                                  down vote













                                                                                  It simply says that the application should be run on a web server. I had the same problem with chrome, I started tomcat and moved my application there, and it worked.






                                                                                  share|improve this answer























                                                                                    up vote
                                                                                    1
                                                                                    down vote










                                                                                    up vote
                                                                                    1
                                                                                    down vote









                                                                                    It simply says that the application should be run on a web server. I had the same problem with chrome, I started tomcat and moved my application there, and it worked.






                                                                                    share|improve this answer












                                                                                    It simply says that the application should be run on a web server. I had the same problem with chrome, I started tomcat and moved my application there, and it worked.







                                                                                    share|improve this answer












                                                                                    share|improve this answer



                                                                                    share|improve this answer










                                                                                    answered Oct 13 '16 at 16:06









                                                                                    Enayat Rajabi

                                                                                    9731129




                                                                                    9731129






















                                                                                        up vote
                                                                                        1
                                                                                        down vote













                                                                                        fastest way for me was:
                                                                                        for windows users run your file on Firefox problem solved, or
                                                                                        if you want to use chrome easiest way for me was to install Python 3 then from command prompt run command python -m http.server then go to http://localhost:8000/ then navigate to your files



                                                                                        python -m http.server





                                                                                        share|improve this answer

























                                                                                          up vote
                                                                                          1
                                                                                          down vote













                                                                                          fastest way for me was:
                                                                                          for windows users run your file on Firefox problem solved, or
                                                                                          if you want to use chrome easiest way for me was to install Python 3 then from command prompt run command python -m http.server then go to http://localhost:8000/ then navigate to your files



                                                                                          python -m http.server





                                                                                          share|improve this answer























                                                                                            up vote
                                                                                            1
                                                                                            down vote










                                                                                            up vote
                                                                                            1
                                                                                            down vote









                                                                                            fastest way for me was:
                                                                                            for windows users run your file on Firefox problem solved, or
                                                                                            if you want to use chrome easiest way for me was to install Python 3 then from command prompt run command python -m http.server then go to http://localhost:8000/ then navigate to your files



                                                                                            python -m http.server





                                                                                            share|improve this answer












                                                                                            fastest way for me was:
                                                                                            for windows users run your file on Firefox problem solved, or
                                                                                            if you want to use chrome easiest way for me was to install Python 3 then from command prompt run command python -m http.server then go to http://localhost:8000/ then navigate to your files



                                                                                            python -m http.server






                                                                                            share|improve this answer












                                                                                            share|improve this answer



                                                                                            share|improve this answer










                                                                                            answered Oct 1 at 3:55









                                                                                            Rezzag Ridha

                                                                                            32229




                                                                                            32229






















                                                                                                up vote
                                                                                                0
                                                                                                down vote













                                                                                                er. I just found some official words "Attempting to load unbuilt, remote AMD modules that use the dojo/text plugin will fail due to cross-origin security restrictions. (Built versions of AMD modules are unaffected because the calls to dojo/text are eliminated by the build system.)" https://dojotoolkit.org/documentation/tutorials/1.10/cdn/






                                                                                                share|improve this answer

























                                                                                                  up vote
                                                                                                  0
                                                                                                  down vote













                                                                                                  er. I just found some official words "Attempting to load unbuilt, remote AMD modules that use the dojo/text plugin will fail due to cross-origin security restrictions. (Built versions of AMD modules are unaffected because the calls to dojo/text are eliminated by the build system.)" https://dojotoolkit.org/documentation/tutorials/1.10/cdn/






                                                                                                  share|improve this answer























                                                                                                    up vote
                                                                                                    0
                                                                                                    down vote










                                                                                                    up vote
                                                                                                    0
                                                                                                    down vote









                                                                                                    er. I just found some official words "Attempting to load unbuilt, remote AMD modules that use the dojo/text plugin will fail due to cross-origin security restrictions. (Built versions of AMD modules are unaffected because the calls to dojo/text are eliminated by the build system.)" https://dojotoolkit.org/documentation/tutorials/1.10/cdn/






                                                                                                    share|improve this answer












                                                                                                    er. I just found some official words "Attempting to load unbuilt, remote AMD modules that use the dojo/text plugin will fail due to cross-origin security restrictions. (Built versions of AMD modules are unaffected because the calls to dojo/text are eliminated by the build system.)" https://dojotoolkit.org/documentation/tutorials/1.10/cdn/







                                                                                                    share|improve this answer












                                                                                                    share|improve this answer



                                                                                                    share|improve this answer










                                                                                                    answered Sep 7 '15 at 10:08









                                                                                                    YUIOP QWERT

                                                                                                    16516




                                                                                                    16516






















                                                                                                        up vote
                                                                                                        0
                                                                                                        down vote













                                                                                                        One way it worked loading local files is using them with in the project folder instead of outside your project folder. Create one folder under your project example files similar to the way we create for images and replace the section where using complete local path other than project path and use relative url of file under project folder .
                                                                                                        It worked for me






                                                                                                        share|improve this answer

























                                                                                                          up vote
                                                                                                          0
                                                                                                          down vote













                                                                                                          One way it worked loading local files is using them with in the project folder instead of outside your project folder. Create one folder under your project example files similar to the way we create for images and replace the section where using complete local path other than project path and use relative url of file under project folder .
                                                                                                          It worked for me






                                                                                                          share|improve this answer























                                                                                                            up vote
                                                                                                            0
                                                                                                            down vote










                                                                                                            up vote
                                                                                                            0
                                                                                                            down vote









                                                                                                            One way it worked loading local files is using them with in the project folder instead of outside your project folder. Create one folder under your project example files similar to the way we create for images and replace the section where using complete local path other than project path and use relative url of file under project folder .
                                                                                                            It worked for me






                                                                                                            share|improve this answer












                                                                                                            One way it worked loading local files is using them with in the project folder instead of outside your project folder. Create one folder under your project example files similar to the way we create for images and replace the section where using complete local path other than project path and use relative url of file under project folder .
                                                                                                            It worked for me







                                                                                                            share|improve this answer












                                                                                                            share|improve this answer



                                                                                                            share|improve this answer










                                                                                                            answered Jun 8 '16 at 3:16









                                                                                                            Naga Sai A

                                                                                                            5,4121824




                                                                                                            5,4121824






















                                                                                                                up vote
                                                                                                                0
                                                                                                                down vote













                                                                                                                For all y'all on MacOS... setup a simple LaunchAgent to enable these glamorous capabilities in your own copy of Chrome...



                                                                                                                Save a plist, named whatever (launch.chrome.dev.mode.plist, for example) in ~/Library/LaunchAgents with similar content to...



                                                                                                                <?xml version="1.0" encoding="UTF-8"?>
                                                                                                                <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                                                                                                                <plist version="1.0">
                                                                                                                <dict>
                                                                                                                <key>Label</key>
                                                                                                                <string>launch.chrome.dev.mode</string>
                                                                                                                <key>ProgramArguments</key>
                                                                                                                <array>
                                                                                                                <string>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</string>
                                                                                                                <string>-allow-file-access-from-files</string>
                                                                                                                </array>
                                                                                                                <key>RunAtLoad</key>
                                                                                                                <true/>
                                                                                                                </dict>
                                                                                                                </plist>


                                                                                                                It should launch at startup.. but you can force it to do so at any time with the terminal command



                                                                                                                launchctl load -w ~/Library/LaunchAgents/launch.chrome.dev.mode.plist



                                                                                                                TADA! 😎 💁🏻 🙊 🙏🏾






                                                                                                                share|improve this answer

























                                                                                                                  up vote
                                                                                                                  0
                                                                                                                  down vote













                                                                                                                  For all y'all on MacOS... setup a simple LaunchAgent to enable these glamorous capabilities in your own copy of Chrome...



                                                                                                                  Save a plist, named whatever (launch.chrome.dev.mode.plist, for example) in ~/Library/LaunchAgents with similar content to...



                                                                                                                  <?xml version="1.0" encoding="UTF-8"?>
                                                                                                                  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                                                                                                                  <plist version="1.0">
                                                                                                                  <dict>
                                                                                                                  <key>Label</key>
                                                                                                                  <string>launch.chrome.dev.mode</string>
                                                                                                                  <key>ProgramArguments</key>
                                                                                                                  <array>
                                                                                                                  <string>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</string>
                                                                                                                  <string>-allow-file-access-from-files</string>
                                                                                                                  </array>
                                                                                                                  <key>RunAtLoad</key>
                                                                                                                  <true/>
                                                                                                                  </dict>
                                                                                                                  </plist>


                                                                                                                  It should launch at startup.. but you can force it to do so at any time with the terminal command



                                                                                                                  launchctl load -w ~/Library/LaunchAgents/launch.chrome.dev.mode.plist



                                                                                                                  TADA! 😎 💁🏻 🙊 🙏🏾






                                                                                                                  share|improve this answer























                                                                                                                    up vote
                                                                                                                    0
                                                                                                                    down vote










                                                                                                                    up vote
                                                                                                                    0
                                                                                                                    down vote









                                                                                                                    For all y'all on MacOS... setup a simple LaunchAgent to enable these glamorous capabilities in your own copy of Chrome...



                                                                                                                    Save a plist, named whatever (launch.chrome.dev.mode.plist, for example) in ~/Library/LaunchAgents with similar content to...



                                                                                                                    <?xml version="1.0" encoding="UTF-8"?>
                                                                                                                    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                                                                                                                    <plist version="1.0">
                                                                                                                    <dict>
                                                                                                                    <key>Label</key>
                                                                                                                    <string>launch.chrome.dev.mode</string>
                                                                                                                    <key>ProgramArguments</key>
                                                                                                                    <array>
                                                                                                                    <string>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</string>
                                                                                                                    <string>-allow-file-access-from-files</string>
                                                                                                                    </array>
                                                                                                                    <key>RunAtLoad</key>
                                                                                                                    <true/>
                                                                                                                    </dict>
                                                                                                                    </plist>


                                                                                                                    It should launch at startup.. but you can force it to do so at any time with the terminal command



                                                                                                                    launchctl load -w ~/Library/LaunchAgents/launch.chrome.dev.mode.plist



                                                                                                                    TADA! 😎 💁🏻 🙊 🙏🏾






                                                                                                                    share|improve this answer












                                                                                                                    For all y'all on MacOS... setup a simple LaunchAgent to enable these glamorous capabilities in your own copy of Chrome...



                                                                                                                    Save a plist, named whatever (launch.chrome.dev.mode.plist, for example) in ~/Library/LaunchAgents with similar content to...



                                                                                                                    <?xml version="1.0" encoding="UTF-8"?>
                                                                                                                    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                                                                                                                    <plist version="1.0">
                                                                                                                    <dict>
                                                                                                                    <key>Label</key>
                                                                                                                    <string>launch.chrome.dev.mode</string>
                                                                                                                    <key>ProgramArguments</key>
                                                                                                                    <array>
                                                                                                                    <string>/Applications/Google Chrome.app/Contents/MacOS/Google Chrome</string>
                                                                                                                    <string>-allow-file-access-from-files</string>
                                                                                                                    </array>
                                                                                                                    <key>RunAtLoad</key>
                                                                                                                    <true/>
                                                                                                                    </dict>
                                                                                                                    </plist>


                                                                                                                    It should launch at startup.. but you can force it to do so at any time with the terminal command



                                                                                                                    launchctl load -w ~/Library/LaunchAgents/launch.chrome.dev.mode.plist



                                                                                                                    TADA! 😎 💁🏻 🙊 🙏🏾







                                                                                                                    share|improve this answer












                                                                                                                    share|improve this answer



                                                                                                                    share|improve this answer










                                                                                                                    answered Jul 5 '16 at 0:37









                                                                                                                    Alex Gray

                                                                                                                    11.3k580104




                                                                                                                    11.3k580104






















                                                                                                                        up vote
                                                                                                                        0
                                                                                                                        down vote














                                                                                                                        • Install local webserver for java e.g Tomcat,for php you can use lamp etc

                                                                                                                        • Drop the json file in the public accessible app server directory

                                                                                                                        • List item


                                                                                                                        • Start the app server,and you should be able to access the file from localhost







                                                                                                                        share|improve this answer

























                                                                                                                          up vote
                                                                                                                          0
                                                                                                                          down vote














                                                                                                                          • Install local webserver for java e.g Tomcat,for php you can use lamp etc

                                                                                                                          • Drop the json file in the public accessible app server directory

                                                                                                                          • List item


                                                                                                                          • Start the app server,and you should be able to access the file from localhost







                                                                                                                          share|improve this answer























                                                                                                                            up vote
                                                                                                                            0
                                                                                                                            down vote










                                                                                                                            up vote
                                                                                                                            0
                                                                                                                            down vote










                                                                                                                            • Install local webserver for java e.g Tomcat,for php you can use lamp etc

                                                                                                                            • Drop the json file in the public accessible app server directory

                                                                                                                            • List item


                                                                                                                            • Start the app server,and you should be able to access the file from localhost







                                                                                                                            share|improve this answer













                                                                                                                            • Install local webserver for java e.g Tomcat,for php you can use lamp etc

                                                                                                                            • Drop the json file in the public accessible app server directory

                                                                                                                            • List item


                                                                                                                            • Start the app server,and you should be able to access the file from localhost








                                                                                                                            share|improve this answer












                                                                                                                            share|improve this answer



                                                                                                                            share|improve this answer










                                                                                                                            answered Jun 8 at 11:05









                                                                                                                            Fred Ondieki

                                                                                                                            2,0342022




                                                                                                                            2,0342022






















                                                                                                                                up vote
                                                                                                                                0
                                                                                                                                down vote













                                                                                                                                I have also been able to recreate this error message when using an anchor tag with the following href:






                                                                                                                                <a href="javascript:">Example a tag</a>





                                                                                                                                In my case an a tag was being used to get the 'Pointer Cursor' and the event was actually controlled by some jQuery on click event. I removed the href and added a class that applies:






                                                                                                                                cursor:pointer;








                                                                                                                                share|improve this answer

























                                                                                                                                  up vote
                                                                                                                                  0
                                                                                                                                  down vote













                                                                                                                                  I have also been able to recreate this error message when using an anchor tag with the following href:






                                                                                                                                  <a href="javascript:">Example a tag</a>





                                                                                                                                  In my case an a tag was being used to get the 'Pointer Cursor' and the event was actually controlled by some jQuery on click event. I removed the href and added a class that applies:






                                                                                                                                  cursor:pointer;








                                                                                                                                  share|improve this answer























                                                                                                                                    up vote
                                                                                                                                    0
                                                                                                                                    down vote










                                                                                                                                    up vote
                                                                                                                                    0
                                                                                                                                    down vote









                                                                                                                                    I have also been able to recreate this error message when using an anchor tag with the following href:






                                                                                                                                    <a href="javascript:">Example a tag</a>





                                                                                                                                    In my case an a tag was being used to get the 'Pointer Cursor' and the event was actually controlled by some jQuery on click event. I removed the href and added a class that applies:






                                                                                                                                    cursor:pointer;








                                                                                                                                    share|improve this answer












                                                                                                                                    I have also been able to recreate this error message when using an anchor tag with the following href:






                                                                                                                                    <a href="javascript:">Example a tag</a>





                                                                                                                                    In my case an a tag was being used to get the 'Pointer Cursor' and the event was actually controlled by some jQuery on click event. I removed the href and added a class that applies:






                                                                                                                                    cursor:pointer;








                                                                                                                                    <a href="javascript:">Example a tag</a>





                                                                                                                                    <a href="javascript:">Example a tag</a>





                                                                                                                                    cursor:pointer;





                                                                                                                                    cursor:pointer;






                                                                                                                                    share|improve this answer












                                                                                                                                    share|improve this answer



                                                                                                                                    share|improve this answer










                                                                                                                                    answered Jun 11 at 14:18









                                                                                                                                    mgilberties

                                                                                                                                    1089




                                                                                                                                    1089






















                                                                                                                                        up vote
                                                                                                                                        0
                                                                                                                                        down vote













                                                                                                                                        Not possible to load static local files(eg:svg) without server. If you have NPM /YARN installed in your machine, you can setup simple http server using "http-server"



                                                                                                                                        npm install http-server -g
                                                                                                                                        http-server [path] [options]



                                                                                                                                        Or open terminal in that project folder and type "hs". It will automaticaly start HTTP live server.







                                                                                                                                        share|improve this answer





















                                                                                                                                        • duplicate answer
                                                                                                                                          – Scott Stensland
                                                                                                                                          Jul 17 at 18:10















                                                                                                                                        up vote
                                                                                                                                        0
                                                                                                                                        down vote













                                                                                                                                        Not possible to load static local files(eg:svg) without server. If you have NPM /YARN installed in your machine, you can setup simple http server using "http-server"



                                                                                                                                        npm install http-server -g
                                                                                                                                        http-server [path] [options]



                                                                                                                                        Or open terminal in that project folder and type "hs". It will automaticaly start HTTP live server.







                                                                                                                                        share|improve this answer





















                                                                                                                                        • duplicate answer
                                                                                                                                          – Scott Stensland
                                                                                                                                          Jul 17 at 18:10













                                                                                                                                        up vote
                                                                                                                                        0
                                                                                                                                        down vote










                                                                                                                                        up vote
                                                                                                                                        0
                                                                                                                                        down vote









                                                                                                                                        Not possible to load static local files(eg:svg) without server. If you have NPM /YARN installed in your machine, you can setup simple http server using "http-server"



                                                                                                                                        npm install http-server -g
                                                                                                                                        http-server [path] [options]



                                                                                                                                        Or open terminal in that project folder and type "hs". It will automaticaly start HTTP live server.







                                                                                                                                        share|improve this answer












                                                                                                                                        Not possible to load static local files(eg:svg) without server. If you have NPM /YARN installed in your machine, you can setup simple http server using "http-server"



                                                                                                                                        npm install http-server -g
                                                                                                                                        http-server [path] [options]



                                                                                                                                        Or open terminal in that project folder and type "hs". It will automaticaly start HTTP live server.








                                                                                                                                        share|improve this answer












                                                                                                                                        share|improve this answer



                                                                                                                                        share|improve this answer










                                                                                                                                        answered Jun 26 at 5:54









                                                                                                                                        sujithklr93

                                                                                                                                        976




                                                                                                                                        976












                                                                                                                                        • duplicate answer
                                                                                                                                          – Scott Stensland
                                                                                                                                          Jul 17 at 18:10


















                                                                                                                                        • duplicate answer
                                                                                                                                          – Scott Stensland
                                                                                                                                          Jul 17 at 18:10
















                                                                                                                                        duplicate answer
                                                                                                                                        – Scott Stensland
                                                                                                                                        Jul 17 at 18:10




                                                                                                                                        duplicate answer
                                                                                                                                        – Scott Stensland
                                                                                                                                        Jul 17 at 18:10










                                                                                                                                        up vote
                                                                                                                                        0
                                                                                                                                        down vote













                                                                                                                                        I suspect it's already mentioned in some of the answers, but I'll slightly modify this to have complete working answer (easier to find and use).




                                                                                                                                        1. Go to: https://nodejs.org/en/download/. Install nodejs.


                                                                                                                                        2. Install http-server by running command from command prompt npm install -g http-server.


                                                                                                                                        3. Change into your working directory, where index.html/yoursome.html resides.


                                                                                                                                        4. Start your http server by running command http-server -c-1



                                                                                                                                        Open web browser to http://localhost:8080
                                                                                                                                        or http://localhost:8080/yoursome.html - depending on your html filename.






                                                                                                                                        share|improve this answer

























                                                                                                                                          up vote
                                                                                                                                          0
                                                                                                                                          down vote













                                                                                                                                          I suspect it's already mentioned in some of the answers, but I'll slightly modify this to have complete working answer (easier to find and use).




                                                                                                                                          1. Go to: https://nodejs.org/en/download/. Install nodejs.


                                                                                                                                          2. Install http-server by running command from command prompt npm install -g http-server.


                                                                                                                                          3. Change into your working directory, where index.html/yoursome.html resides.


                                                                                                                                          4. Start your http server by running command http-server -c-1



                                                                                                                                          Open web browser to http://localhost:8080
                                                                                                                                          or http://localhost:8080/yoursome.html - depending on your html filename.






                                                                                                                                          share|improve this answer























                                                                                                                                            up vote
                                                                                                                                            0
                                                                                                                                            down vote










                                                                                                                                            up vote
                                                                                                                                            0
                                                                                                                                            down vote









                                                                                                                                            I suspect it's already mentioned in some of the answers, but I'll slightly modify this to have complete working answer (easier to find and use).




                                                                                                                                            1. Go to: https://nodejs.org/en/download/. Install nodejs.


                                                                                                                                            2. Install http-server by running command from command prompt npm install -g http-server.


                                                                                                                                            3. Change into your working directory, where index.html/yoursome.html resides.


                                                                                                                                            4. Start your http server by running command http-server -c-1



                                                                                                                                            Open web browser to http://localhost:8080
                                                                                                                                            or http://localhost:8080/yoursome.html - depending on your html filename.






                                                                                                                                            share|improve this answer












                                                                                                                                            I suspect it's already mentioned in some of the answers, but I'll slightly modify this to have complete working answer (easier to find and use).




                                                                                                                                            1. Go to: https://nodejs.org/en/download/. Install nodejs.


                                                                                                                                            2. Install http-server by running command from command prompt npm install -g http-server.


                                                                                                                                            3. Change into your working directory, where index.html/yoursome.html resides.


                                                                                                                                            4. Start your http server by running command http-server -c-1



                                                                                                                                            Open web browser to http://localhost:8080
                                                                                                                                            or http://localhost:8080/yoursome.html - depending on your html filename.







                                                                                                                                            share|improve this answer












                                                                                                                                            share|improve this answer



                                                                                                                                            share|improve this answer










                                                                                                                                            answered Aug 28 at 16:07









                                                                                                                                            TarmoPikaro

                                                                                                                                            1,65611430




                                                                                                                                            1,65611430






















                                                                                                                                                up vote
                                                                                                                                                -1
                                                                                                                                                down vote













                                                                                                                                                Many problem for this, with my problem is missing '/' example:
                                                                                                                                                jquery-1.10.2.js:8720 XMLHttpRequest cannot load http://localhost:xxxProduct/getList_tagLabels/
                                                                                                                                                It's must be: http://localhost:xxx/Product/getList_tagLabels/



                                                                                                                                                I hope this help for who meet this problem.






                                                                                                                                                share|improve this answer

























                                                                                                                                                  up vote
                                                                                                                                                  -1
                                                                                                                                                  down vote













                                                                                                                                                  Many problem for this, with my problem is missing '/' example:
                                                                                                                                                  jquery-1.10.2.js:8720 XMLHttpRequest cannot load http://localhost:xxxProduct/getList_tagLabels/
                                                                                                                                                  It's must be: http://localhost:xxx/Product/getList_tagLabels/



                                                                                                                                                  I hope this help for who meet this problem.






                                                                                                                                                  share|improve this answer























                                                                                                                                                    up vote
                                                                                                                                                    -1
                                                                                                                                                    down vote










                                                                                                                                                    up vote
                                                                                                                                                    -1
                                                                                                                                                    down vote









                                                                                                                                                    Many problem for this, with my problem is missing '/' example:
                                                                                                                                                    jquery-1.10.2.js:8720 XMLHttpRequest cannot load http://localhost:xxxProduct/getList_tagLabels/
                                                                                                                                                    It's must be: http://localhost:xxx/Product/getList_tagLabels/



                                                                                                                                                    I hope this help for who meet this problem.






                                                                                                                                                    share|improve this answer












                                                                                                                                                    Many problem for this, with my problem is missing '/' example:
                                                                                                                                                    jquery-1.10.2.js:8720 XMLHttpRequest cannot load http://localhost:xxxProduct/getList_tagLabels/
                                                                                                                                                    It's must be: http://localhost:xxx/Product/getList_tagLabels/



                                                                                                                                                    I hope this help for who meet this problem.







                                                                                                                                                    share|improve this answer












                                                                                                                                                    share|improve this answer



                                                                                                                                                    share|improve this answer










                                                                                                                                                    answered Jul 12 '16 at 5:31









                                                                                                                                                    Ngô Đức Tuấn

                                                                                                                                                    536




                                                                                                                                                    536

















                                                                                                                                                        protected by Community Nov 10 '15 at 8:01



                                                                                                                                                        Thank you for your interest in this question.
                                                                                                                                                        Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                                                                                                                        Would you like to answer one of these unanswered questions instead?



                                                                                                                                                        Popular posts from this blog

                                                                                                                                                        Guess what letter conforming each word

                                                                                                                                                        Port of Spain

                                                                                                                                                        Run scheduled task as local user group (not BUILTIN)