Forum Moderators: open
I try
<A HREF="http://www.urlwidget37578.com">
But then it shows it as text, with the & LT; and & GT; instead of < and >.
<A HREF="http://www.urlwidget37578.com">name</a>
<A HREF="http://www.urlwidget37578.com">name</a>
<A HREF="http://www.urlwidget37578.com">name</a>
and not
name [urlwidget37578.com] name [urlwidget37578.com] name [urlwidget37578.com] name [urlwidget37578.com]
If I use < and > then it changes from links to the text showing LT; and > , so that doesn't work.
:::You could put them in a textarea.
Now that looks like a good idea, in a form box.
File 1: "url.txt"
<a href="widget.htm">Widget</a>
<a href="widget.htm">Widget</a>
<a href="widget.htm">Widget</a> File 2: "urllist.php"
<?php header("Content-type: text/html");?>
<html><head><title></title>
<style type="text/css">
textarea {border:none;}
</style>
</head><body>
<h1>test txt file insert</h1>
<textarea cols="100" rows="3"><?php readfile("url.txt")?></textarea>
</body></html> The CSS removes the border, making the textarea seamless, and you need to set the number of rows in the textarea to the number of entries in the "url.txt" file to avoid getting a scrollbar (you can use CSS to banish the overflow to make sure the scrollbar never appears, but that'd get in the way of this example). Of course, there may be a simpler way...
textarea needs to be written in HTML.
I got a database of links in .txt files - Jesse_Smith
These are .txt files no matter how IE is misinterpreting them. So using textarea, while a possible hack, is not addressing the real issue: Why is IE not reading the file correctly?
"...IE renders my .txt files as text files just fine. I'm currently using 6.0, but they rendered OK in 5.5 as well. Must be how you are accessing the .txt file or how the .txt file is being served..."
If you access the .txt file straight off your hard drive, IE reads it correctly as text. If you have it served through a webserver IE gets confused sometimes. (i.e. it gets confused when there is an <a> tag in the file, but not when there is <a). From what I can see this happens even though the webserver might be configured correctly to serve .txt files as mime type = "text/plain"
If you have access to php then universalis' suggestion means you don't have to make changes to the text files. If you don't, an alternative solution to the textarea one is to wrap the contents of the file around an html framework. Then you will be able to use the <.
i.e.
<!DOCTYPE HTML....>
<html>
<head>
</head>
<body>
<A HREF="http://www.urlwidget37578.com">name</a>
<A HREF="http://www.urlwidget37578.com">name</a>
<A HREF="http://www.urlwidget37578.com">name</a>
</body>
<html>
keyplyr, what do you mean by "textarea needs to be written in HTML"?
Shawn
I can only speak from my experience. I serve a couple dozen .txt files with <a> tags and never has IE confused any of them as HTML files. In 6 years, never have I received feedback that anyone else has either.
Do the pages in which the files are accessed validate? Are full DTD with W3C URI used, or are you forcing IE to render in quirks mode?
No, I mean IE gets confused when presented with a straight text file with no doctype declaration, but with the webserver configured to serve it as mime type "text/plain". i.e. just a straight forward text file, not ammended for serving to the web. I respect your 6 yrs experience, but I can and have reproduced Jesse_Smith's symptoms only half an hour ago. As I said, IE only gets confused sometimes (i.e. when the contents of the text file look like html, such as when it contains an <a> tag), which may explain why you have not seen the problem before.
What do you mean by "textarea needs to be written in HTML"? Am I missing something?
Shawn
I meant that if the textarea code is rendered from a .txt file, it would just show up as code, not as an actual textarea... as all HTML tags would on a .txt file. I say this because, once again, I have never experienced the quirks that you two seem to be.
I still think that this malady is the result of IE running in quirks mode because of some non-standard code, page, PHP or whatever path the webmaster is using to access the .txt file.
Good luck
How do I find out if it's that? If it has some non-html stuff before the links, then it shows up as text instead of HTML.
I just turned it in to .shtml and used
<A HREF="http://www.urlwidget37578.com">blah</a>
for every link.
If you're hosted on an Apache-based server you can fix this yourself, but I need to look up the details. If you're hosted on a system that uses a different server software package, you'll have to contact your hosting service's tech support. But try my little experiment and see what happens first.
>>>"... wonder if Jesse's server is sending "Content-type: text/html" for the text file in question, making MSIE treat it as an HTML file..."
Don't know about Jesse, but in my case the server is configured correctly, and other browsers recognise it as text. See msg#10 & msg#12.
Copy; paste into text file; save as test.txt in your favourite webserver's web pages directory; point IE browser to [localhost...] Hey, what do you know!
From what I can see this is an IE bug. I don't think its a webserver problem... I could be wrong...
I think I understand the problem. As always with Microsoft, "its not a bug, it's a feature!" IE4+ uses "MIME type detection" to work out how a document should be served. It does look at the MIME type given by the server, but the MIME type
text/plain is considered as "ambiguous", so the detection algorithm kicks in. Seeing as your text file contains HTML, IE reckons that it should have been served as text/html. This, as you can see, is stupid. Check out this article which details the bug^h^h^h feature: [msdn.microsoft.com...]
Hope this answer is more useful...!
I must take you to task on one issue, however: I think your previous post was equally helpful. It presented a good workaround, even though the root cause of the problem was not yet clear. ;) Even now that the problem is understood, your post is still probably the best solution if php is available on the server.
Shawn
Thanks, universalis. That fits with the symptoms I see. Certainly no need to crawl behind a rock!
Feeling all warm and fuzzy inside :D
I think your previous post was equally helpful. It presented a good workaround ... probably the best solution if php is available on the server.
Of course for my original reply, you can easily replace PHP with ASP or Coldfusion, or just do an include virtual if you only have bog-standard SSI. If you don't have PHP, ASP, Coldfusion or SSI, then change hosts!