1

got some great feedback last time.

I'm essentially setting up a Wiki-type system on my local computer. I'm linking between HTML files, with some already existing and some not. I'm using XMLHttpRequest to check to see if the files exist.

The problem comes when I need to check files that are in different directories. I've come to find out this is a security thing in place. However, I'd like to disable it if possible, just for my local files. It seems rather odd that I can't have simple Javascript that returns the text on any web page at all, but even more so on my own computer.

I don't have any sort of server software running, just a bundle of HTML files with Javascript in them.

Thanks in advance!

Duckfin
  • 33
  • 1
  • 3
  • have you looked in to setting a caspol? Assuming you're doing this from the browser, there are certain limits on what you can and can't do normally, but in the past I have created a full trust caspol that allows me access to things I wouldn't normally have access to (like certificate keystores from the browser). – Brian Feb 08 '12 at 22:44
  • you are better off using Flash. Javascript is no match to what you want to achieve because It simply can not get through to the file system because of security reasons – Jaspreet Chahal Feb 08 '12 at 22:44
  • This may help: http://stackoverflow.com/questions/1087246/can-javascript-access-a-filesystem/3405736#3405736 – Jordan Feb 08 '12 at 22:47
  • You can try the HTML5 File API: http://www.html5rocks.com/en/tutorials/file/dndfiles/ – Eliseu Monar dos Santos Feb 08 '12 at 22:55

3 Answers3

0

javascript can not talk to the local filesystem. The reason for this is to keep people from writing destructive scripts that break your computer.

thenetimp
  • 9,487
  • 5
  • 29
  • 42
  • That's not entirely true. There are ways that Javascript can talk to the local filesystem from within a browser, although normally you're correct. You certainly can't from an internet site. – Jordan Feb 08 '12 at 22:51
0

If this isn't a learning exercise, perhaps you might be interested in TiddlyWiki?

Jordan
  • 31,971
  • 6
  • 56
  • 67
0

As you mention your self, "this is a security thing in place". In general, JavaScript is not allowed to access local files as it violates the sandbox.

However, have a look at these SO posts that discuss a few possible solutions:

You can also have a look at this HTML5 feature:

Community
  • 1
  • 1
Christofer Eliasson
  • 32,939
  • 7
  • 74
  • 103