18

Is there any way I can use HTML5 and JavaScript to modify a file on my system? I'm OK with running Chrome or Firefox with specific options or opening permissions in some other way.

Ideally I would like test this by having my browser rename a file on my desktop.

2

3 Answers 3

6

Yes, you can do this, this link details some of the available functionality:

http://www.html5rocks.com/en/tutorials/file/filesystem/

Just remember, it's not supported in the major browsers yet, and it's likely when it is many of your visitors will not upgrade for quite some time.

Sign up to request clarification or add additional context in comments.

5 Comments

It looks like this only gives you access to a sandboxed filesystem
Here's some text from the link: It's important to remember that this file system is sandboxed, meaning one web app cannot access another app's files. This also means you cannot read/write files to an arbitrary folder on the user's hard drive (for example My Pictures, My Documents, etc.).
@Kirk: That's actually a Good Thing. Would you like just any ol' webpage to access your documents? Like, your personal data? I wouldn't, for one.
@Piskvor For my particular use case I'd like it to have access to approved directories in the file system
Cool side note: Google Chrome is building an in browser editor. github.com/GoogleChrome/code-editor-app
3

No, as this would be a security vulnerability. As pointed out there are sandboxed file systems, or local database storage in HTML5, but not access to the whole file system.

You could achieve it with a certified Java applet, if you really wanted to achieve it through the browser. To be honest the browser is not the best place to be trying such things.

1 Comment

Java applets are no longer supported, so I would use the File System Access API to modify local files instead.
-1

VBScript should be appropriate in your case. You will have to lower your internet zone security level though.
Once it's done just use ActiveXObject("Scripting.FileSystemObject") and its MoveFile method.

4 Comments

That's not html, its proprietary internet explorer trash
@Sevin7 check kirk's comment
internet explorer tr... treasure! :straight-face:
Which is no longer supported by anyone, not even MS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.