Solved

Placing text from a .txt file within HTML

Posted on 2012-04-11
5
181 Views
Last Modified: 2012-05-09
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?
0
Comment
Question by:piemckay
5 Comments
 
LVL 2

Expert Comment

by:kamalranjan
ID: 37832637
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.
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37832638
<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
0
 

Author Comment

by:piemckay
ID: 37832740
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?
0
 
LVL 23

Accepted Solution

by:
basicinstinct earned 500 total points
ID: 37836566
it is impossible to access a file on the client machine file system under normal conditions...

why don't you use cookies instead?

if you ONLY need to support IE and you can set the browser to put your site trusted or intranet zone then you can script the FileSystemObject
0
 

Author Closing Comment

by:piemckay
ID: 37946328
Most helpful suggestion.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now