[thelist] parse file.js with PHP

Hassan Schroeder hassan at webtuitive.com
Thu Jun 27 11:08:08 CDT 2002


"Means, Eric D" wrote:

> > No, /not returning a proper content-type header/ is the bad idea;
> > the file's name/extension is irrelevant.  :-)
>
> Well, yes, except that the server (initially) sets the content type based on
> the extension.  So a PHP file is likely to be served as text/html.  Now, if
> you were to use header() to set the content type properly that would cease
> to be an issue.

"if"? What "if", Kemo Sabe? :-)

It's up to the implementer to explicitly return the correct content
type in a header. I don't use PHP for this, but I use JSP pages for
content-types "text/css" and "text/javascript" regularly.

> However, I don't know if there are browsers out there that *do* use the
> extension and ignore the content-type (improperly), so that's something to
> take into account.

I don't know either, but "coding to standards" seems a reasonable
approach, at least until a problem surfaces  :-)

--
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

    -- creating dynamic Web sites and applications since 1994 --



More information about the thelist mailing list