<p>Which is the best method to make the browser use cached versions of js files (from the serverside)?</p>

From PHP:
```
```
function OutputJs($Content) 
{   
    ob_start();
    echo $Content;
    $expires = DAY_IN_S; // 60 * 60 * 24 ... defined elsewhere
    header("Content-type: x-javascript");
    header('Content-Length: ' . ob_get_length());
    header('Cache-Control: max-age='.$expires.', must-revalidate');
    header('Pragma: public');
    header('Expires: '. gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
    ob_end_flush();
    return; 
}
```
```
works for me.
As a developer you'll probably quickly run into the situation that you
don't
want files cached, in which case see
Help with aggressive JavaScript caching