Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Linking to a webpage in HTML?
How do I link to a HTML file that doesn't have a HTML file extension? I know that I can use <a href="pageone.html"... for but if the file extension is something different it wont work.
4 Answers
- Leo DLv 61 decade agoFavorite Answer
To be exact, no HTML files (actually, no files on the Internet) should have extensions.
The W3C makes it clear that a cool URI does not reveal the technology used to make a resource. The reason why is: Say that you have your Website with all GIFs (this is prior to browser-wide GIF support) and one day, you decide to change all of the GIFs to PNGs (except for the animated GIFs); if there were people who linked to your original GIF-extension images, there'd be a LOT of broken links on your Website, which is bad news for it because people dislike broken links. If those links never had extensions, the common user wouldn't even notice that you ever made the switch.
And cool URIs never turn into broken links. (That's the whole point of them, lol.) http://www.w3.org/Provider/Style/URI
What you should do is keep your extension but on your server. Now when your resources get served, they'll be served with smart URLs (instead of http://example.com/loch.jpeg like on your server-side, the user agent will see http://example.com/loch/ which is a smarter URL). And the extensions on the server-side help to serve the correct mimetype.
Now, since I know next to nothing about server-side (I'm sorry :( I'm still studying that, but I've got more important things first), I can't give you good advice. And different servers sometimes do things differently. Things you might want to read up on are essentially Apache Server technologies, PHP (Personal Home Page: Hypertext Processor), CGI (Common Gateway Interface) and HTTP (HyperText Transfer Protocol). On a different server, you might want to take up ASP (Active Server Pages) instead of PHP and Apache Server technologies.
But if you want to use HTML to make a specific link a specific file type, you'd do it this way, <a href="pageone.non-html-extension" type="text/html">Page 1</a>
You might want to experiment with it, because I don't have a Website and haven't been able to test on this: try to see if application/xhtml+xml has worse results than text/html on IE6, try to see if "text/html, application/xhtml+xml" is better or "application/xhtml+xml, text/html" is better.
If the page you are linking to has a different encoding type, you might want to suggest that as well, for example, if you're linking to a "text/html" page with a UTF-8 encoding and yours is something different, you'd put in "text/html; charset=UTF-8". All application/xhtml+xml Web pages should be UTF-8 or UTF-16, but UTF-8 is a better idea since UTF-16 should be used on a need-to-use basis. If you have a choice, try to stick with UTF-8 for all your web pages. Using the type attribute with a "text/"-supertype tends to get the next Web page to load with the encoding of the last page especially on older browsers.
BUT, using HTML to serve your anchor is as bad practice as using using style attributes, like for example <a href="pageone.non-html-extension" style="text-decoration: none; color: red;">Page 1</a> Because, server-side languages can fix mime-types across your entire Domain instead of just one link at a time (like a stylesheet versus a style attribute). This also overrides the default of that web page, and if the page switched to becoming a PDF or something, and you didn't check that link, the user would only get garbage data (compare to styles again). It's also better practice to minimise on HTML where a server-side language could do the job and better. (And talk about bloating the HTML if you need to add more than one type attribute.) After all, HTML's purpose is to structure and apply semantics, not to serve, that's what server-side languages are for.
Before doing all of this, just make sure that they page even works in the first place. You'd be putting a lot of effort to fixing a problem that doesn't exist if it does work. If the page is on a different server, there's the large possibility that it would work anyway.
IFF: the page is on your computer, then you should really make use of the correct extension ^_^; Your computer isn't the Internet, so server-side would have no effect there. You could also experiment with the anchor type-attribute that I mentioned earlier, but remember to get rid of them when you upload.
I hope this helps!
Source(s): HTML standardista experience. - Chris CLv 71 decade ago
It will work, as long as the extension is understood by the computer.
For instance, you can send a text file by having the extension be ".txt" (instead of ".html" or ".htm").
Or open it in Excel if the extension is ".csv".
- MichelleLv 71 decade ago
What kind of extension are you trying to link to that does not work? ... Please make sure that you are spelling the page correctly and that it is uploaded to the location you are trying to link to. (go to www.yoursite.com/pagetwo.asp or whatever to make sure the page you are trying to link to actually exists.)
- 6 years ago
you should search yahoo or google for your answer. I belief it is better for you.