[thelist] parse file.js with PHP

Gijs van Tulder evolt at gmx.net
Thu Jun 27 10:32:00 CDT 2002


The easiest method is probably this:

- put the following in file.php
<?php
// text/javascript, not text/html
header("Content-type: text/javascript");

// your script
?>

- don't link to file.php, but to file.php/javascript.js

This way, you've got everything a browser could ever want:
- the correct Content-type-header
- it even has a .js-extension

Gijs



More information about the thelist mailing list