How to load an external webpage into a div of a html page
jquery
Solution
Using simple html,
<div>
<object type="text/html" data="http://validator.w3.org/" width="800px" height="600px" style="overflow:auto;border:5px ridge blue">
</object>
</div>
Or jquery,
<script>
$("#mydiv")
.html('<object data="http://your-website-domain"/>');
</script>
JSFIDDLE DEMO
Problem
I need to load a responsive website into a div in my HTML page without using an `iframe` element. I have tried this link; it's working for a single page URL, which I mentioned in the script. ``` $('#mydiv').load('http://localhost/qa/ask#external-div', function(response, status, xhr) { if (status == "error") { var msg = "Sorry but there was an error: "; alert(msg + xhr.status + " " + xhr.statusText); } }); ```
Related problems
- Use of Iframe or Object tag to embed web pages in another
- How can I load webpage content into a div on page load?
- Difference between iframe, embed and object elements
- how to access the elements of the HTML loaded in object tag?
- How do I load a webpage inside a div using Javascript without IFRAME and JQuery?