0

Possible Duplicate:
jQuery cross domain iframe scripting

I got an iframe that is calling an external url. At this point I'm working localhost.

<iframe id="iframeid" src="https://www.example.com/"></iframe>

All the content is showed correct.

Now I want to make some changes via jquery or javascript, and I noticed that I haven't access to the elements inside iframe. I mean if I do

$('#iframeid').load(function(){
    var iframeBody = $("#iframeid").contents().find("body").length;
    console.log('iframeBody -->'+iframeBody);
});

it returns always 0 (zero).

I know that because I'm working with differents domains I got browser restrictions. But I saw this post and tried using that plugin but I still got the undefined value.

Anyone can helpe me??

Thanks all

Community
  • 1
  • 1
saomi
  • 855
  • 5
  • 16
  • 38
  • 1
    Did you read the description for that plugin? All it does is allow you to request data from a domain using jQuery's ajax method, it doesn't allow you to insert abritrary code into an iframe. There are a lot of [answers](http://stackoverflow.com/a/3083131/551093) on this subject, as it's been asked a million times, and nothing has changed. They're all correct. – Christian Jan 29 '13 at 18:35
  • You can't do this because it would be a major security flaw. Any sites that have facebook integration would know the facebook passwords being used on the site. iframe is its own instance of the browser and doesn't share anything with its parent site other than being displayed on it. – howderek Jan 29 '13 at 19:16

0 Answers0