Detection of Server
<p>Is there a way to have Javascript autodetect wether its server is local(127.0.0.1) or production(http://www.example.com) and set a variable accordingly?</p>

<p>For example in PHP is use this function to do reloads and it works local or production:</p>

<pre><code>  public static function reload()
    {
    $uri = 'http://';
    $uri .= $_SERVER['HTTP_HOST'];
    header('Location: '.$uri);
    }
</code></pre>

<p>This way I won't have to remember to edit my local_on variable when uploading my script from development to production.</p>
