Professional Web Applications Themes

Content Type Question - Macromedia Dreamweaver

I have a question concerning the content type of an HTML file. I have a perl script that outputs the source of an HTML file. However, when I view this perl script in Mozilla, the script output appears as the HTML source code, not as the HTML page itself. When I add the line "content-type: text/html" to the top of the file, the script is displayed as HTML. Why does this single line of code matter? And what is the difference between this and the following line of HTML: "<meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1">" I don't understand the difference of the ...

  1. #1

    Default Content Type Question

    I have a question concerning the content type of an HTML file. I have a perl script that outputs the source of an HTML file. However, when I view this perl script in Mozilla, the script output appears as the HTML source code, not as the HTML page itself. When I add the line "content-type: text/html" to the top of the file, the script is displayed as HTML.

    Why does this single line of code matter? And what is the difference between this and the following line of HTML:

    "<meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1">"

    I don't understand the difference of the two and why the former is more important. Can anyone shed any light on this for me?

    Thanks,
    Jonah B.

    Jonah Bishop
    JGB Productions
    jonahb webforumsuser@macromedia.com Guest

  2. #2

    Default Re: Content Type Question

    I'm guessing that the extension of your page is probably either .cgi or .pl.
    Since these are raw text files anyway, if the browser doesn't know how to
    translate them, then you'll probably end up with text on the screen.
    Usually, the browser is set up to translate HTML if the extension is also
    ..htm(l). No problems there. But anything else, it doesn't necessarily
    know. However, if the browser sees the content type in there, then it can
    p it properly.

    I ran into a similar problem a while back with .hcsp files, the proprietary
    extension for our content management system. Adding the content type to the
    page, as well as setting the mime type on the server to text/html, fixed the
    problem for me in all cases and all browsers.

    Best regards,
    Chris


    Chris In Madison Guest

Similar Threads

  1. #38235 [Com]: mime_content_type does not return content type
    By sonne at gaskanalen dot dk in forum PHP Bugs
    Replies: 0
    Last Post: December 21st, 05:48 PM
  2. Need help with Content-Disposition Content-Type
    By Arg in forum PHP Development
    Replies: 0
    Last Post: September 3rd, 08:34 PM
  3. get content type out of a local file
    By John Smith in forum PHP Programming
    Replies: 5
    Last Post: February 18th, 08:51 AM
  4. Content Type = EXCEL in browser
    By Chris Davoli in forum ASP.NET General
    Replies: 0
    Last Post: July 14th, 01:43 PM
  5. PHP, Apache and content-type negociation
    By Bertrand Mollinier Toublet in forum PHP Development
    Replies: 0
    Last Post: July 8th, 08:38 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139