Without using iframes, is it possible to load the contents of
<div id="siteloader"></div>
With an external site e.g. somesitehere.com
When the page loads? - I know how to load contents from a file, but wasn't sure how to load a whole site?
Many thanks,
This is possible to do without an
iframe
specifically. jQuery is utilised since it's mentioned in the title.You can't inject content from another site (domain) using AJAX. The reason an iFrame is suited for these kinds of things is that you can specify the source to be from another domain.
Take a look into jQuery's .load() function:
However, this only works on the same domain of the JS file.
With jQuery, it is possible, however not using ajax.
And then place
onload="LoadPage()"
in the body tag.Although if you follow this route, a php version might be better: