Renamed detect.js to detect.php and use a rewrite instead trying to parse the js file parse directly by PHP