G1i1ch
G1i1ch

Reputation: 251

Is it possible to use the File JavaScript api to load a server side file?

A quick question, I recently checked out the new html5 File api for javascript. See it here. Is it possible to use it to pull in a server side file without ajax? I know there's a File object in JavaScript, could I do a "new File("serverSideStuff.xml");" with that?

Upvotes: 0

Views: 205

Answers (3)

Marcelo De Zen
Marcelo De Zen

Reputation: 9497

It is not possible because the user must be aware of what your are loading, and is the user who can tell you what you can load or not.

Upvotes: 0

Danil Speransky
Danil Speransky

Reputation: 30453

No, it is only for local files, as I know.

Upvotes: 0

Jibi Abraham
Jibi Abraham

Reputation: 4696

From the API description -

Using the File API added to the DOM in HTML5, it's now possible for web content to ask the user to select local files, then read the contents of those files.

So no, you can't select server side files

Upvotes: 1

Related Questions