Oh my god, I think the solution you are looking for is with IFRAME. However, the iframe approach is both mental and technical. I suggest you start with this guide:
Cross Domain Communication with IFrames
An alternative approach is to retrieve data from another server asynchronously using script and json tags:
<script src="http://remotesite.com/path/to/script/blah.js"></script>
script DOM innerHTML.
, , , script, DOM. :
function require (url, callback) {
if (!isScriptLoaded(url)) {
document.write('<script src="' + url + '" type="text/javascript" charset="utf-8"><\/script>');
if (callback) {
callback();
}
}
}
function isScriptLoaded(src) {
var scriptsLoaded = {};
var scriptTags = document.getElementsByTagName("script");
for (var i = 0, script; script = scriptTags[i]; i++) {
if (script.src) {
scriptsLoaded[script.src] = 1;
}
};
if (scriptsLoaded[src]) {
return true;
}
return false;
}
(, !)
- .