Find image TAG and replace the source with a domain name
<p>I am trying to work on a Jquery code which can find <code>src</code> of all <code>&lt;img&gt;</code> tags in the page and replace and append that with <a href="https://s3.amazonaws.com/abc" rel="nofollow">https://s3.amazonaws.com/abc</a> so for example </p>

<pre><code>&lt;img src="/v/abx/templates/210/images/clear1x1.gif" width="5" height="5" alt="" /&gt;
</code></pre>

<p>Should be replaced with </p>

<pre><code>&lt;img src="https://s3.amazonaws.com/abc/v/abx/templates/210/images/clear1x1.gif" width="5" height="5" alt="" /&gt;
</code></pre>

<p>The Main issue is it should happen on page Load</p>

<p>I have the following Javascript code but it doesnt work</p>

<pre><code>&lt;!-- START: javascript to manipulate product photo URLs --&gt;
&lt;script type="text/javascript"&gt;
if(location.href.indexOf(‘/product_p/’) != -1) {
var ThisPhoto=document.getElementById('product_photo').src;
var ImgServer='https://s3.amazonaws.com/abc';
var ThisDomain=document.domain;
var NewImgSrc = ThisPhoto.replace(ThisDomain,ImgServer);
document.getElementById('product_photo').src=NewImgSrc;
}
&lt;/script&gt;
&lt;!-- END: javascript to manipulate product photo URLs --&gt;
</code></pre>
