wasser Posted September 15, 2013 Share Posted September 15, 2013 Although launching a local web server with Python is pretty easy (python -m SimpleHTTPServer <port>), I often choose to just run a temporary instance of Chrome with the --allow-file-access-from-files flag. This should bypass Chrome's check for preventing local assets from loading due to same-origin policy. Here's how you'd do it on various systems: OSXopen -a Google\ Chrome --args --allow-file-access-from-filesWindows1) create a shortcut of Chrome2) right-click on the shortcut3) go to "Properties" and "Shortcut"4) Edit the Target field to read something like: "C:\Program Files\Google\Chrome\Application\chrome.exe" --args --allow-file-access-from-filesLinuxgoogle-chrome --allow-file-access-from-filesIf Chromium is your cup of tea, it will work there as well, just replace references to Chrome(.exe) with the appropriate Chromium executable. You could also use the "--disable-web-security" flag instead, but it's a little more far-reaching, I believe, and browsing other sites with that flag enabled is probably not a great idea Tip: Make sure all running instances of Chrome (also check task manager for running processes) are killed before starting a new instance of Chrome like this. Hope this is useful for someone. Thanks,wasser Dang_Khoa 1 Link to comment Share on other sites More sharing options...
mathaeus Posted September 17, 2013 Share Posted September 17, 2013 Nice trick, but I'm not sure if you're not overdoing it. First, you have to close your Chrome session before starting it again with the parameters, then remember to close it again after doing your stuff. You also loose the ability to use domain- and protocol-relative URLs. Because of that, starting a simple server seems much faster, doesn't it? Link to comment Share on other sites More sharing options...
YellowAfterlife Posted September 17, 2013 Share Posted September 17, 2013 I imagine that such method would work if Chrome isn't your primary browser (thus can be kept just for running that single instance of game). Launching a Python or Neko webserver is easy enough of process by itself though - if you feel that lazy, under Windows you can also add a single registry key to grant you a "Launch web server here" item for folder' context menu. Link to comment Share on other sites More sharing options...
totor Posted September 17, 2013 Share Posted September 17, 2013 I imagine that such method would work if Chrome isn't your primary browser (thus can be kept just for running that single instance of game). Launching a Python or Neko webserver is easy enough of process by itself though - if you feel that lazy, under Windows you can also add a single registry key to grant you a "Launch web server here" item for folder' context menu. i am that lazy, how do you do that ? The latest Flashdevelop has a webserver for testing Html5, haven't tested it though, just installed. Link to comment Share on other sites More sharing options...
Orillian Posted September 18, 2013 Share Posted September 18, 2013 I use EasyPHP for all my local webserver needs. Gives me a quick and lightweight WAMP. Best part is you can have multiple php versions for testing purposes and it is pretty easy to setup SSL if you require it.. Then there is the built in php webserver if you only need the bare minimum. O. Link to comment Share on other sites More sharing options...
jb.tellez Posted September 20, 2013 Share Posted September 20, 2013 My fave is node's http-server Just enter http-server from the terminal in whatever directory you like and you're ready to go.You'll need Node.js. - jb Link to comment Share on other sites More sharing options...
Pedro Alpera Posted September 21, 2013 Share Posted September 21, 2013 I use Anvil, only mac: http://anvilformac.com/ It's really easy to use, and it's free. Link to comment Share on other sites More sharing options...
qubodup Posted September 23, 2013 Share Posted September 23, 2013 It should be possible to avoid having to restart chrome by adding--user-data-dir="/home/qubodup/tmpuser"(that's the Linux option when the user is 'qubodup') Link to comment Share on other sites More sharing options...
PAEz Posted September 23, 2013 Share Posted September 23, 2013 Just a couple of little points... What wasser wrote is right but keep in mind your path to Chrome is likely to be different...typically Chrome is only installed in the programs folder if you install it through some pack or something, but right clicking on the shortcut will tell you. Also, there is no need for the "--args". What qudodup wrote is also right. Having a profile just for development is a good idea as you can remove any extensions that might interfere with your work. If you want a new profile, but want it to start off where your current profile is at then you can copy your current profiles folder somewhere else and rename it to whatever. All your current profiles are kept in a directory called User Data that you will find in Chromes directory, copy that whole directory to somewhere and point the --user-data-dir to it. If you ever want to know what the Chrome command line arguments are then go here....http://peter.sh/experiments/chromium-command-line-switches/ Link to comment Share on other sites More sharing options...
Recommended Posts