...

View Full Version : how to populate a textbox with a text from a txt file located in a local drive



jnvu_16
07-02-2012, 06:15 AM
I have a textbox wherein whenever the user goes to my website, the textbox will be populated by the txt file that I would put in a specific drive in the user's computer. For example let's say that this is the address "F:\sample.txt". How do I do this? And by the way, I want to use javascript on this one since I want this to be on the client side.

abduraooft
07-02-2012, 06:50 AM
the textbox will be populated by the txt file that I would put in a specific drive in the user's computer. You can't put anything to user's computer without his/her permission - for security reasons.

jnvu_16
07-02-2012, 07:24 AM
You can't put anything to user's computer without his/her permission - for security reasons.

So how do I ask for the user's permission? I don't want to use ActiveX since it only works in IE and I want my website to be opened in all browsers. Thanks for the quick reply btw.^_^

Philip M
07-02-2012, 08:29 AM
JavaScript does not have any commands for reading or writing files. Modern browsers can read files on the server using an Ajax call, but otherwise JavaScript has no capability to read from, write to, modify or delete a file (except a cookie), communicate with the server, access a database, the client's operating system or the Windows registry, or alter the default behaviour of the browser. And for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.

It would help if you indicated the kind of text you want to display. Presumably you want it to vary from user to user.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum