0

I am trying to load content of iframeB from iframeA which is showing a wordpress website that is running live.It works find but the issue is that the JavaScripts of iframeB that is copied from iframeA is not fired normally and some errors are shown. I suspect this is happening because IframeB is not loaded the normal way.

IframeA is loaded the normal way linking to a source. Thus, no errors are shown. If i do the below approach many JavaScript errors are shown because i am replacing the html contents.

Here is the code:

var $inhtml = $('iframeA').contents().find('html');

var iframeBcon = $('<iframe />',{id: 'iframeB',
                                 class:'frameclass',
                                 height: 600,
                                 width: "100%"
                  });


$iframeBcon.appendTo('body');


$iframeBcon.contents().find('html').html($inhtml);

My question is this:

  1. Is there a way where i can put the html codes to iFrameB before appending to the body so that the iframe will load as a normal html request like how it acts when a src is specified?

  2. Any best approach to suggest?

madi
  • 5,612
  • 5
  • 36
  • 48

0 Answers0