How to load external webpage in html page div

I need to load a responsive website into a div on my HTML page without using an iframe element.

I tried this link ; it works for the single page URL that 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); } }); 
+51
jquery web
Aug 09 '13 at 11:04 on
source share
1 answer

Using plain 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

+84
Aug 09 '13 at 11:09 on
source share



All Articles