Forum Moderators: phranque
AddHandler application/x-httpd-php .js
It works. The only problem is that when a user tries to view the .js file, it gets served up as application/x-httpd-php and the browser renders it as such (ignoring whitespace and such). So I add a line of php in the .js file:
header("content-type:application/x-javascript");
It works. But I don't want to have to add this line in all my current (and future) .js files that won't be using any php. So I add another directive:
AddType application/x-javascript .js
It doesn't work. I went so far as to put an htaccess file in my js directory with the following:
ForceType application/x-javascript
Still any .js file that doesn't have it's content-type explicitly set with a call to php's header() gets served as x-httpd-php. This is not strictly a big deal since the javascript still functions normally, but it'd be nice to have it render like normal in browsers. Is there any way to do that? Thanks.