Wietse de Vries
Wietse de Vries

Reputation: 685

Get content of external div

I have a new problem. I wan't to get the content of a div from a external webpage. If I look in de page-source I see <div id="content">...</div>. How can I display the content with document.write()?

This question is written in really bad English, but I hope you understand what I mean.

Upvotes: 0

Views: 409

Answers (3)

korywka
korywka

Reputation: 7653

try to load external page to iframe 1x1 pixel and work with inner html.

Upvotes: 0

Smamatti
Smamatti

Reputation: 3931

$('div#content').load('path/to/external_page.htm');

Not possible across domains without proper script which does the request for you.

Upvotes: 0

NCode
NCode

Reputation: 2808

This isn't possible, because modern browser block this so called cross-site-scripting. It would be quite a security problem if every website could load your facebook page an read personal data. http://en.wikipedia.org/wiki/Cross-site_scripting

But there could be a solution using php's file_get_contents, depending on your situation http://www.php.net/manual/en/function.file-get-contents.php

Upvotes: 3

Related Questions