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,
You can use <embed> tag, instead of <object> tag.
You could use an <iframe> in order to display an external webpage within your webpage. Just place the url of the webpage that you want to display inside the quotes of the src attribute. Show activity on this post. Either you use an iframe or you load the site via AJAX into a div (e.g. using jQuerys load() method).
We can use the object tag in HTML to embed external resources in the webpage. We can use the tag to display another webpage in our webpage. The object tag is an alternative to the iframe tag in HTML. We can use the tag to embed different multimedia components like image, video, audio, etc.
This is possible to do without an iframe
specifically. jQuery is utilised since it's mentioned in the title.
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Load remote content into object element</title> </head> <body> <div id="siteloader"></div> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script> $("#siteloader").html('<object data="http://tired.com/">'); </script> </body> </html>
Take a look into jQuery's .load() function:
<script> $(function(){ $('#siteloader').load('http://www.somesitehere.com'); }); </script>
However, this only works on the same domain of the JS file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With