Welcome to WebmasterWorld Guest from 54.226.25.231

Forum Moderators: incrediBILL

Message Too Old, No Replies

creating a link to txt file

html

     

Samzer

7:34 am on Feb 15, 2012 (gmt 0)



hi,
i want to create a link in an html environment to open text file in a new page. can some help because i can create a link to open a html and php file its working but it cant open a txt file. please find the coding i used:
<div style="position:absolute;bottom:0px; text-align:center;left: 450px;"><a href = "code.txt" target= "_blank"> code</a>
</div>

penders

8:36 am on Feb 15, 2012 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



There shouldn't be any difference between an HTML file and a .txt file. Remove the spaces around the '=' in your anchor (although that's probably not your problem).

What browser are you testing?

g1smd

8:44 am on Feb 15, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Is the text file in the same folder as the HTML page that calls it?

If not, begin the link with a leading slash and specify the full path to the file in that link.

Samzer

1:48 pm on Feb 15, 2012 (gmt 0)



the text file and the html file are in the same folder and i am using internet explorer

Samzer

1:49 pm on Feb 15, 2012 (gmt 0)



if i am creating the same link to html file or php file it opens without a problem. my problem is the txt.

g1smd

2:45 pm on Feb 15, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



There should be no difference what you open.

Fotiman

3:00 pm on Feb 15, 2012 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



it cant open a txt file

What exactly happens when you click on the link to a text file? What does your browser do? Perhaps the server is configured with the wrong mime type for the .txt file extension?

You could try installing Fiddler [fiddler2.com] to examine the raw request and response data between the browser and the server.

sam_gibbs

8:24 pm on Feb 15, 2012 (gmt 0)



You have to place txt file in the same folder where you have saved html file and don't give any extra space in A tag. You can test it by placing both files on your desktop, then your code would be like this
<a href="test.txt" target= "_blank">TEXT FILE LINK</A>
Thanks

Sam

[edited by: tedster at 11:17 pm (utc) on Feb 15, 2012]

4serendipity

12:17 am on Feb 16, 2012 (gmt 0)

10+ Year Member



I'm with the previous posters in thinking that you're either running into either a directory path or mime type issue.

Also, if you don't absolutely have to post the content in a text file, you could try creating a basic HTML template and pasting the content within a <pre> element. This would keep the door open to format the content down the road.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month