danwoods
danwoods

Reputation: 4907

FileReader API working in jsFiddle, but not from local file

I'm working on a Chrome/Firefox extension which will be using the file API to store files locally. I'm trying to get an example up and running but I'm running into issues which seem to center around Chrome. Can anyone explain why this jsFiddle works fine, but the exact same code, when run from a local file, doesn't work. Please note that it works fine in Firefox, just not in Chrome. Any ideas?

Upvotes: 3

Views: 837

Answers (3)

kongaraju
kongaraju

Reputation: 9586

If you are using chrome. Start the chrome from command line with the flag --allow-file-access-from-files chrome doesn't support for accessing local file without this flag.

Upvotes: 0

Ry-
Ry-

Reputation: 224859

Chrome has unusually restrictive web security; many things, like Ajax, won't work when run locally. This is one of them. You can get around this problem by either using a local websever, like @ephemient suggests, or you can run Chrome in unsafe mode for testing:

chrome.exe --disable-web-security

Upvotes: 1

ephemient
ephemient

Reputation: 204668

Yep. Chrome's SOP prevents just about everything in file:// from working[1]. Use a local webserver instead.

Upvotes: 0

Related Questions