0

I'm trying to send this command:

document.body.innerHTML = document.body.textContent;

like in this script:

var iframeBody = $(window.my_frame.document.getElementsByTagName("body")[0]);
iframeBody.append($("<h1/>").html("Hello world!"));

in this jsfiddle

HTML:

<iframe id='my_frame' src="http://www.sec.gov/Archives/edgar/data/1168960/0001052918-13-000257.txt"></iframe>

nevertheless it does not executes; anyone knows why?

cheers

Community
  • 1
  • 1
user2376068
  • 207
  • 1
  • 4
  • 11

2 Answers2

1

You have a Same Origin Policy problem. You can't access the contents of an iframe that resides on a different domain to yours.

In the fiddle, you also didn't include jQuery.

MrCode
  • 63,975
  • 10
  • 90
  • 112
0

this does the trick http://jsfiddle.net/Paulpro/fDN7t/

 <div id="example"></div>

 $('#example').load('http://www.sec.gov/Archives/edgar/data/1168960/0001052918-13-000257.txt');
user2376068
  • 207
  • 1
  • 4
  • 11