Results 1 to 9 of 9
  1. #1
    Silver Lounger Bruce K's Avatar
    Join Date
    Apr 2002
    Location
    Phoenix, Arizona, USA
    Posts
    1,876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTML code meaningful & important?

    Since some of these lines of code are with out '<!--', I am assuming they are being read. Are these lines important in any regard?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <META http-equiv=Content-Type content="text/html; charset=windows-1252">

    <META content="MSHTML 6.00.2716.2200" name=GENERATOR>

    Besides the W3 standard and english, what exactly is being denoted here specifically in these three lines?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    Cincinnati, Ohio, USA
    Posts
    7,089
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTML code meaningful & important?

    Yes, the lines are being read. Good coding practices usually include things like this, not just in HTML but in most programming languages. The top section of the document contains declarations for the reading application so that the output is properly formatted.

    The first line specifies the document type for browsers and servers. The browser uses the DOCTYPE element to decide how the document should be rendered. In this instance it states that the document is coded in HTML 4.0 transitional, which allows tags like [b] and <font> to be used properly, as opposed to 'strict' HTML. If you specify the document as 'strict' then browsers will attempt to render the page using W3C specifications, which can lead to some unexpected results. Although HTML pages will probably work without it, it's not considered a valid HTML document without this declaration. Also, it specifies the version of HTML - which, like most computer resources, has different versions, just like an operating system. Read more about document type declarations here.

    The META tags are descriptors about the document. They can contain authoring information, keywords for search engines, and many other things. Yours, in this example, define the character set used to create the document - so if a Japanese visitor opens the page, the browser knows which character set to use. This can affect the appearance of forms and other page elements. META tags can redirect the browser to a different page, refresh the current page, and proper use of keywords is paramount to obtaining good search engine rankings.

    The second line defines the program used to create the document, which appears to be an Office application of some kind.

    HTH,
    -Mark

  3. #3
    Silver Lounger Bruce K's Avatar
    Join Date
    Apr 2002
    Location
    Phoenix, Arizona, USA
    Posts
    1,876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTML code meaningful & important?

    Thank you for the link! I went to the W3 site, but misssed the link for that page. Except for the 'MSHTML' & 'GENERATOR', this helps immensely <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTML code meaningful & important?

    Hi Bruce,

    I'm not sure if you've noticed this or not, but FrontPage signs its pages with a similar tag: <meta name="GENERATOR" content="Microsoft FrontPage 5.0">

    As I understand it, this helps IE know which icon to show for the "Edit with..." button (located on the right-side of the toolbar by default). Also, in a webpage created with FrontPage, you'll usually find quite a few comment tags (< ! - - ... - - >) with FP-specific commans (such as webbots, navigation controls, etc...). All of this information is meaningless to web browsers, but is required by FrontPage in order to make things work and display properly with the Server Extensions and in the Editing interface.

    (These extra tags are the very thing that made me become suspicious of FrontPage a while back - then I discovered Hand-coding! .... but that's another story for another day.)

    All of this - just in case you were curious! <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  5. #5
    Silver Lounger Bruce K's Avatar
    Join Date
    Apr 2002
    Location
    Phoenix, Arizona, USA
    Posts
    1,876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTML code meaningful & important?

    Hi, Mark!

    Thank you for the info. Yes, I am a curious creature. There is a second half to "curiosity killed the cat" that goes "<something> brought it back", but I forget what <something> is.

    Anyhow, 'GENERATOR' is the environment in which the document was created then, right?

    I really dislike FrontPage and have used it occasionally when I began toying with HTML to do down and dirty edits. I prefer to work with a combination of hand coding and Dreamweaver. I have created pages and left out tags that seem to make no difference. One thing I have learned is the many different ways you can use HTML and have different outcomes, for example, embedding sound or javascripts. I have at least 5 different ways to use the same sound, but depending on which tags you use and where, the way it is executed is different.

  6. #6
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Coppell, Texas, USA
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTML code meaningful & important?

    Jumping in late and you've got your answer but I wanted to mention one thing:

    That second line of code is "bad" in a sense. The same information should be in the HTTP header sent when a requested file is sent to the browser. If the charset in the header and META tag don't match, you can have problems (especially using Netscape). So if you're codeing web pages using ASP or something like it, set the content type and charset in the Response header, not the HTML.

    In ASP, you can do this using the Response object:

    Response.CharSet = "windows-1252" '// latin1
    Response.ContentType = "text/html"

    instead of

    <META http-equiv=Content-Type content="text/html; charset=windows-1252">

    which means the same thing. The reasoning is that the browser reads the HTTP headers before the content, and settings have a better chance of working if the browser hasn't started parsing/rendering the HTML. This is true for cache-control as well.

    HTH

  7. #7
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTML code meaningful & important?

    Charlie,

    Thanks a million for that tip! I'm putting the final touches on a survey management system (SQL Server back-end and Access front-end to create dynamic web-based surveys in 7 languages). (You can see a static "proofing" copy of the survey at: my website - only 3 languages were complete when I generated this copy.) I have all of the data stored in Unicode (utf-8). I have been sending the charset and content with a meta tag and noticed that Netsape 4.79 would hiccup each time it pulled up a page: It would flash the page in Chinese or Japanese (two of the languages we're using) before showing it in the selected language (such as English or Spanish). There wasn't really a problem with the way it was working, but it just looked funny.

    With your tip, I was able to prevent this from happening. Now, the page loads in perfectly in any language - actually it loads even faster than before.

    I've been doing web/ASP work for a while (of course, this is my first multi-language project), and I always learn something new every day.

    KUDOS - and thanks again! <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

  8. #8
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Coppell, Texas, USA
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTML code meaningful & important?

    Mark,

    I've been doing the localization/internationalization of our product's Admin UI for the last year. I was fortunate to stumble on this tidbit while doing the research on character set encodings. Glad you found it useful. Let me know if you see any other issues - form submission and Code Page issues can be tricky, although it sounds like you're using UTF-8 successfully. I may need to pick your brains about that in the future.

    Good luck!

  9. #9
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: HTML code meaningful & important?

    <hr><something>brought it back<hr>
    satisfaction brought it back
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •