Reputation: 2541
This code works great, it just only works on the link[href]
and nothing else
$("iframe").load(function() {
$("iframe").contents().find("script[src], img[src], link[href], a[href]").each(function(i) {
this.href = this.href.replace(/^http:\/\/www\.mydomain\.com/, "http://www.theotherdomain.com");
});
});
Upvotes: 0
Views: 218
Reputation: 6882
This is because you try to set the href
attribute this.href = ...
but the only element that has href
is a link. For images and scripts, you have to set the src
attribute.
Upvotes: 1