View Full Version : Grab Exterrnal Site Div Content
BRIAN_C_C
Oct 4th 2007, 8:01 pm
Is it possible to display the <div id=""> content from an external domain/site and display it on my own... I don't want their whole page... just some reports they update weekly...
ezpz
Oct 4th 2007, 8:17 pm
I don't think you can interact with another website in this way, because browsers enforce a same-origin policy to prevent cross-site scripting - see http://en.wikipedia.org/wiki/Cross-site_scripting
temp2
Oct 4th 2007, 8:52 pm
If you want to do this thing, you should use server languages to read URL, check to filter data you need
aRo`
Oct 5th 2007, 3:38 am
an approuch in javascript would be to load the external url in an iframe and then read the source code of the iframe.
use Ajax to do so, grab the external code via php or asp, and handle that in javascript using innerHTML property. thats it!!
ezpz
Oct 6th 2007, 12:49 am
Does the external site know you want to do this, and approve? If they do, they might be willing to make it easy for you, putting the reports in a stand-alone page that you can include with a simple iFrame.
If they don't, perhaps you shouldn't go this way. They could change the id of their div at some point, which would break your site, or they could actively block your server-side IP address if you're planning to do it server side.
And call me old-fashioned, but it just seems wrong...
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.