Javascript: Is there a way to automatic change localhost to the ip address when go live
<p>I have a website which is completely client-side. When it is in a testing environment, I use localhost for all links to other services: databases, report builders, etc. </p>

<p>When the website is deployed to apache2, for to go live, I have to manually change those link to the IP address of the server.</p>

<p>Is there any way in code to avoid doing this? Or, is the only way to automatically change them (grunt for example) during the deployment phase?</p>