Jump to content

OpenSource library for Javascript


roseli98
 Share

Recommended Posts

Javascript in the browser can't access files. It is designed that way for security reasons. It is possible to have local storage, but not in ordinary files.Where is this file? Is it on the local machine with the browser or is it on the server? You can move the file to the server and then be able to access it using server-side code.

Edited by davej
Link to comment
Share on other sites

If the file is on the same domain then you can send an ajax request to read the contents of it. That will be a normal request, as if you typed in the URL of the file yourself. You can also send a request to something like a PHP script which can read the file and return the data to Javascript.

  • Like 2
Link to comment
Share on other sites

The html/javascript could co-exist with the file that it's going to access. Will javascript work too? If using server side code, what will you recommend?

 

 

This is a client-server situation. The client has a browser and the client-browser talks -- over the network -- to the server.

 

What do you want to do with the file?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...