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