Replace / change links within iframes

Hi,

I’ve got an iframe on my page that displays my affiliate’s webpages (located on their domain).

Two concerns:

First, all links within the iframe reveal their domain name in the status bar and in the page source, i.e. <a href=“affiliate.com/buy.htm”>.

Second, the links in the iframe have target=“_blank” which opens new tabs/windows, also exposing their domain to my customers.

Would it be possible to replace all instances of “affiliate.com” inside the iframe to “mysite.com”; whereas, “mysite.com” will be a proxy forwarding requests to “affiliate.com”? Keep in mind that these elements do not have ID or Class.

Any advice is welcomed!

Can any other languages do the job?

JavaScript has no access to the page in the iframe when it is a different domain.