Copy html content from iframe into div ( ajax )?

Lets assume I have my browser load an Iframe with <iframe src="test.html">

Can I, using ajax, load the content of test.html into a div in the main html page?

This idea is my solution for that fact that I'm actually trying to overcome the limitation with making ajax submits to remote hosts. The plan is to generate the dynamic page with 0 sized iframe which makes report request to remote host. Then, after the page (& iframe content) loads I will copy the iframe content into a div using JS.

Tips are appreciated,

Thank you, Maxim.


No, you can't.

When you load a page from a different domain into the iframe, it becomes unreachable. You can no longer access the contents of the iframe, as it comes from a different domain.

The only thing that I know of that you can reliably load from a different domain is a script, which JSONP uses.

Need Your Help

Conflicting htaccess rewrite rules

regex .htaccess mod-rewrite

I am using two rewrite rules within a directory - one to remove php extension from all php files and the other for a pretty URL but they seem to be clashing with each other.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.