chewey Posted June 23, 2016 Share Posted June 23, 2016 Hi, Can someone explain to me please why Pixi must use a local server to test stuff you have written? ( Im using a Mac with NodeJS installed, and run the server via command line ) And how does that work on a remote server? I find it works really well having recently taken it up - but like a TV, Im not 100% sure why it works. Many thanks Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 23, 2016 Share Posted June 23, 2016 Because browser works with web-server and not the file system. It expects actual domain, cross-domain policies, accept-language and other headers. For your comfort, some actions are working with FS, but do not expect everything. Most of it wont work because of security reasons, that way virus in some html page you downloaded cant start sending your private info to a hacker. That's how I do it: npm install -g http-server cd myServerRootFolder http-server -c-1 pxlatedtraveler 1 Quote Link to comment Share on other sites More sharing options...
kaan Posted June 24, 2016 Share Posted June 24, 2016 or create an unsecure, standalone chrome. for OSX: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/Users/whoisthis/Documents/chrome-session --disable-web-security (for windows google it) tho if you browse the web with this unsecured browser, you might be doomed ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 24, 2016 Share Posted June 24, 2016 ( Bender_DOOMED.gif ) Seriously, don't do that. d13 1 Quote Link to comment Share on other sites More sharing options...
d13 Posted June 24, 2016 Share Posted June 24, 2016 2 hours ago, ivan.popelyshev said: ( Bender_DOOMED.gif ) Seriously, don't do that. I second that!!! Anyone reading this - please do not take kaan's advice it's extremely dangerous. Quote Link to comment Share on other sites More sharing options...
chewey Posted June 24, 2016 Author Share Posted June 24, 2016 Ok - so basically the issue is security? Ive built sites in PHP with frameworks and I know I use a local server for testing as its getting stuff from a DB, but this not being the case I assumed it might be different? Quote Link to comment Share on other sites More sharing options...
kaan Posted June 25, 2016 Share Posted June 25, 2016 I used to do it for a cordova emulator that I built, I could use chrome practically to test a mobile app exactly like on a device But I second everyone's warnings, sometimes you forget the chrome is unsecured, google some stuff etc. then deal with the paranoia that ensues Still, you have to be extremely unlucky for someone to reach a local file this way, since it's an extremely low probability, I don't guess many exploiters would be on the lookout for such a naive soul Quote Link to comment Share on other sites More sharing options...
mattstyles Posted June 27, 2016 Share Posted June 27, 2016 On 6/24/2016 at 5:20 PM, chewey said: Ok - so basically the issue is security? Ive built sites in PHP with frameworks and I know I use a local server for testing as its getting stuff from a DB, but this not being the case I assumed it might be different? Yeah, file:// protocol is a restricted protocol to try and keep separation between your local machine and the big bad internet. If your project does not require anything from the internet (fonts, images, etc) then it might well work fine (some libraries will do things that don't like file:// protocol though). Given that firing up a static server is trivial, even on Windows, it shouldn't be a problem for anyone (actually, I could caveat that, it could be an issue for non-web devs who want to use the web platform as a target, but, it doesn't take too long to figure it out and its likely their tooling would manage it anyway). Quote Link to comment Share on other sites More sharing options...
Exca Posted June 27, 2016 Share Posted June 27, 2016 If you for some reason dont want to use web-server, other possibility is to use a fiddler (or other similar web tool) to setup a local proxy that maps certain urls to local file system. Quote Link to comment Share on other sites More sharing options...
chewey Posted June 27, 2016 Author Share Posted June 27, 2016 Great - thanks for the replies! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.