homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
creating a link to txt file
html
Samzer




msg:4417805
 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




msg:4417840
 8:36 am on Feb 15, 2012 (gmt 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?

g1smd




msg:4417842
 8:44 am on Feb 15, 2012 (gmt 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.

Samzer




msg:4418047
 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




msg:4418048
 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




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

There should be no difference what you open.

Fotiman




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

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




msg:4418170
 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




msg:4418212
 12:17 am on Feb 16, 2012 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved