[thelist] External Javascript files + PHP

Joe Crawford jcrawford at avencom.com
Thu Oct 25 13:03:40 CDT 2001


Arthur Noel wrote:
> 
> > >Based on your problem, I think you need to add a
> > Content-Type header so that
> > >the browser respects it as a .js file.
> > >
> > ><? Header('Content-Type: text/javascript')?> should do it.
> >
> > Funny thing is that this sensible suggestion just makes things worse.
> 
> I think that's cos it should be application/x-javascript not
> text/javascript, at least that's what Apache comes with by default.

crap! my bad.

I should've tested an external .js file which was working - I forgot the
mimetype and just guessed. :-(

http://www.delorie.com/web/headers.cgi?url=http%3A%2F%2Fwww.lightpointe.com%2Fblocks%2Fscripting.js

Corrected then:
<? Header('Content-Type: application/x-javascript')?>

Sorry about that Andrew - and thanks Arthur. That's one I'll remember in
the future!

	- Joe <http://artlung.com/>
-- 
...................  Joe Crawford \\ Web Design & Development
.....  mailto:jcrawford at avencom.com \\ http://www.avencom.com
.... San Diego \\ CA \\ USA \\ AVENCOM: Set Your Sites Higher




More information about the thelist mailing list