Standard extension for a file containing an html fragment?

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).
LVL 2
JamesNewtonAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
neesterConnect With a Mentor Commented:
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
 
neesterCommented:
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
 
cristy56Connect With a Mentor Commented:
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
COBOLdinosaurCommented:
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
 
neesterCommented:
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
 
neesterCommented:
BTW Cd&,
Internet Explorer will not render a .txt with HTML inside it as HTML either.
I just tested it too...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.