[thelist] External Javascript files + PHP

Joe Crawford joe at artlung.com
Thu Oct 25 00:29:59 CDT 2001

Andrew Forsberg wrote:

> "Lindsay Evans" rightly asked:
>> do you have a url we could look at?
> Funny thing is, when I tried it out in isolation so I could give you
> an url, everything worked fine. It's just when I dump this
> particular, much larger, script into an external file that
> something's going wrong -- and it's hard to work out quite what's
> choking it because the error message just relates to the <script
> type="text/javascript" src="blah.php"> line. Weird that it works
> inline, but not externally. If I have time I'll try a process of
> elimination.

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.

Point this:

At your js file - I'd bet a quarter that it's delivering text/html rather
than what you /want/ it to do, which is text/javascript.

Here's a css file off evolt, which delivers up text/css:

    - Joe
...........  Joe Crawford : thinking and design about the web
.... enigmatic narcissism and miscellany : http://artlung.com
.... community instigator : http://WebSanDiego.org
.... San Diego, California, USA .....................AAAFNRAA

More information about the thelist mailing list