Jump to content

Why from a local server


chewey
 Share

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...