Reputation: 1813
Is it possible to get <div>
Content from a another Site and put it with JS in the currect Site?
Example:
Website 1 have a Portal and want include Content from Website 2.
Website 2 have in <div id="content"></div>
the required Content.
Website 1 will get the Content with JS and put it into <div id="content_here"></div>
Upvotes: 0
Views: 93
Reputation: 3441
IF website1 & website2 from maches the same origin policy then you can access the Iframe from the JS, if you have access to both of the websites you can pass the origin policy by using JSONP for example appendHtml(html)
otherwise no you cant (as fast ideas came into my mind)
hope this helps,
Upvotes: 1
Reputation: 337700
No, this is not possible via javascript. Any request made via javascript must made be to the same domain as the originator. This is a security feature of most browsers known as the Same Origin Policy.
The only work-around is to scrape the source of the external domain via a server-side language, such as PHP
or ASP.Net
and then make the AJAX request to that locally.
Upvotes: 2