Modifying links

Modifying links

I have a page that is on a secure server, lets say https://server.com and I have a link on a page /somelink.html

I am trying to use jQuery to change the link to http://server.com/somelink.html

Here is the code I have come up with:

 
  1. $(document).ready(function() {
            $("a[href^='https://server.com']")
            .each(function()
            {
               this.href = this.href.replace(/^https:\/\/server\.com/,
                  "http://www.server.co");
            });
             $("a[href^='/']")
            .each(function()
            {
               this.href = this.href.replace(/^\//,
                  "http://www.server.co");
            });
          
            });
















However, my code only seems to work in Firebug after everything has rendered.  I assume that the links are changes when the Document is Ready but before the server address is attached to the links.

Thanks in advance.