• HTML code meaningful & important?

    Home » Forums » Developers, developers, developers » Web design and development » HTML code meaningful & important?

    Author
    Topic
    #378862

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

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

    Viewing 1 reply thread
    Author
    Replies
    • #628665

      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 and 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,

      • #628670

        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 smile

        • #628673

          Hi Bruce,

          I’m not sure if you’ve noticed this or not, but FrontPage signs its pages with a similar tag:

          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! scratch

          • #628705

            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 “ brought it back”, but I forget what 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.

            • #630729

              [indent]


              brought it back


              [/indent]
              satisfaction brought it back

              Cheers,
              Paul Edstein
              [Fmr MS MVP - Word]

    • #630170

      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

      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

      • #630213

        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! thankyou

        • #630282

          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!

    Viewing 1 reply thread
    Reply To: HTML code meaningful & important?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: