create javascript code in a php file - SAFARI/CHROME doesn't work

cristianods

New Member
I've created a .php file that write out js code like that:\[code\]<?//my_js.php// javascript headerheader('Content-type: text/javascript');// Date in the pastheader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');// always modifiedheader('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');// HTTP/1.1header('Cache-Control: no-store, no-cache, must-revalidate');header('Cache-Control: post-check=0, pre-check=0', false);?>//// js code here//\[/code\]then i include the script above in my index.php file like this:\[code\]<script type="text/javascript" src="http://stackoverflow.com/questions/3653851/my_js.php?id=<? echo $id ?>"></script>\[/code\]This works perfect in Firefox, but SAFARI and CHROME doesn't include my_js.php file at all!What i'm doing wrong?**edit:this is the rendered html in index.php:\[code\]<script type="text/javascript" src="http://stackoverflow.com/questions/3653851/my_js.php?id=new"></script> \[/code\]and this is the my_js.php code:(it's a very big file so i write out only the first few lines)\[code\]var g = { sitepath: "myNullUrl" }function getBrowserWidth(){if (window.innerWidth){ return window.innerWidth;} else if (document.documentElement && document.documentElement.clientWidth != 0){ return document.documentElement.clientWidth; }else if (document.body){return document.body.clientWidth;} return 0;}\[/code\]that's a strange problem 'cos while i'm viewing source code from Crome/Safari i can access the js file and it seems to be error free!I'm using Chrome 6.04 and Safari 5, both for mac.
 
Back
Top