Solved

Standard extension for a file containing an html fragment?

Posted on 2004-10-05
6
1,231 Views
Last Modified: 2013-11-19
In other words, what do you call a file that has HTML tags in it, but only the tags that would normally appear between <BODY and </BODY. It doesn't have the <HTML <HEAD or <BODY tags?

I was thinking .INC but that is so overused and I would like that to be reserved for ASP code includes. .WAP is almost... .TXT isn't enough.

I spent about 15 minutes searching on the net and on ee specifically, but good keywords seem to be hard to come by: "html fragment" "without <head" "without <html" "html without extension" all came to nothing.

The answer will hopefully allow some sort of functionality in terms of being recognizable (e.g. starts with .H) and official (Microsoft, rfc, netscape, etc... said so).
0
Comment
Question by:JamesNewton
  • 4
6 Comments
 
LVL 11

Expert Comment

by:neester
ID: 12232937
I believe .htm is fine.
There are no "real" standards that I know of...
You could use .tpl (template)....
I would stick with .htm (as opposed to .html) - just so you can see its different, but you can also load the fragment in the browser indivicually without having a forced download (if you use .tpl - most browsers will come up with a download dialogue)...
0
 
LVL 5

Assisted Solution

by:cristy56
cristy56 earned 250 total points
ID: 12233616
You can still name it as .htm , there is no problem with that.

I have tried many times with htm files where there is no <head><body> tag etc, and it can just be a plain text file with a few tags like <font color=xxx> etc and it still works without showing up errors. So I guess u can still name it as .htm


Regards,
Cristy
0
 
LVL 11

Accepted Solution

by:
neester earned 250 total points
ID: 12233919
Christy56

There is no doubt you can name the file whatever you like.
You can call it .exe if you like - the file will be the same, but the browser will not treat it the same.

I am assuming that James will be using a server side language to insert these files into a bigger page...
If that is the case, then it doesnt matter what you name it.
They could be .jpg if you liked.

But you wouldnt be able to view the fragment through your browser.
It would assume it is an image, and give you an error when the HTML is loaded instead of the image.

My recommendation stands at:
.htm for fragment.
and a .html if its a full page.

Purely to differentiate the two files - and also because they both will be interpreted correctly by the browser (for the contents that the files hold).
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12239698
The html extension has nothing to do with whether it is a well-formed and complete document.  the content IS html.  if it is be sued as an include then .inc or .shtml is appropriate, but infact it is a text file and if you give it a .txt extension and send it to a browser, it will still be rendered as html.

Cd&
0
 
LVL 11

Expert Comment

by:neester
ID: 12243463
COBOLdinosaur - but the truth is - there is no real standard here.
.inc is not defined as a HTML fragment...

.txt pages with HTML code SHOULD NOT be rendered HTML.
FireFox doesn't render txt files as HTML.
I just ran a test with the source of this page.

I think James was just looking for some advice on the BEST way to go about it.
I guessed he is using a template system for a website.
And this is the method i have used.
It makes life easier - when looking through folders...

And sometimes a template doenst work, and you can easily load the HTML fragment in the browser still if its a .htm...

THanks for the Grade A James :)
0
 
LVL 11

Expert Comment

by:neester
ID: 12243483
BTW Cd&,
Internet Explorer will not render a .txt with HTML inside it as HTML either.
I just tested it too...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now