Link to home
Start Free TrialLog in
Avatar of piemckay
piemckay

asked on

Placing text from a .txt file within HTML

I'm looking for an easy way to get access a text file on a local machine, which contains the users name; I want to display on a HTML page. Is there way to do this preferably with Javascript.

So file is at %userprofile%\name.txt

I want to appear at <h2>Welcome to our site {DISPLAY NAME}</h2>

Any ideas?
Avatar of kamalranjan
kamalranjan
Flag of India image

I believe you can not access local file system directly. Alternatively you can create a ActiveX control in VB or any other language and use that to access and fetch the desired data from the text file. You can then use that returned value from a function in that User Control and use that in your HTML page. Use Javascript to call the function from that ActiveX control and use the returned value in your respective HTML tag.
<script language="javascript" src="text.txt"></script>

Then create a new text file in the same folder as your html file called text.txt and put this in it:

document.write('Your text file');


http://www.webmasterworld.com/forum21/11352.htm
Avatar of piemckay
piemckay

ASKER

Yes it would appear to be impossible to use a serverside script to access data on the client. I will have a look at using activex. Any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of basicinstinct
basicinstinct
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Most helpful suggestion.