Welcome to WebmasterWorld Guest from 184.72.148.222

Forum Moderators: incrediBILL

Message Too Old, No Replies

creating a link to txt file

html

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

New User

joined:Feb 14, 2012
posts: 3
votes: 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>
8:36 am on Feb 15, 2012 (gmt 0)

Senior Member

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

joined:July 3, 2006
posts: 3123
votes: 0


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?
8:44 am on Feb 15, 2012 (gmt 0)

Senior Member

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

joined:July 3, 2002
posts:18903
votes: 0


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.
1:48 pm on Feb 15, 2012 (gmt 0)

New User

joined:Feb 14, 2012
posts: 3
votes: 0


the text file and the html file are in the same folder and i am using internet explorer
1:49 pm on Feb 15, 2012 (gmt 0)

New User

joined:Feb 14, 2012
posts: 3
votes: 0


if i am creating the same link to html file or php file it opens without a problem. my problem is the txt.
2:45 pm on Feb 15, 2012 (gmt 0)

Senior Member

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

joined:July 3, 2002
posts:18903
votes: 0


There should be no difference what you open.
3:00 pm on Feb 15, 2012 (gmt 0)

Senior Member from US 

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

joined:Oct 17, 2005
posts:4986
votes: 12


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.
8:24 pm on Feb 15, 2012 (gmt 0)

New User

joined:Oct 21, 2008
posts: 7
votes: 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]

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

Full Member

10+ Year Member

joined:Jan 5, 2003
posts:202
votes: 0


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.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members