Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Change part of images src inside an iframe

I have a page with an iframe (in the same domain) with lots of images with src="../../imageXX.gif"

I need to change those srcs to "../imageXX.gif"

I´m doing somthing like:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

$('iframe').load(function() {
    var src = $(this).contents().find('img').attr('src').replace('/../' ,'/'); 
    $('img').attr('src', src);
})

>Solution :

I think you mean

$('iframe').load(function() {
  $(this).contents().find('img').each(function() {
    let src = $(this).attr('src');
    $(this).attr('src',src.replace('/../' ,'/')); 
  })
})
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading