PDA

View Full Version : load a full webpage into div



jonnyfreak
03-31-2017, 10:17 AM
i have a webpage that i want to be able to show external websites in the div. i have looked but can find what i need. i can see url in a div but i need to be able for the full webpage to be shown in the div not just part of the URL

thanks in advance

molendijk
03-31-2017, 02:31 PM
There are many ways to do it. See this (http://stackoverflow.com/questions/17636528/how-do-i-load-an-html-page-in-a-div-using-javascript), for example.

jonnyfreak
03-31-2017, 03:30 PM
There are many ways to do it. See this (http://stackoverflow.com/questions/17636528/how-do-i-load-an-html-page-in-a-div-using-javascript), for example.

this link provide does not load a full webpage into a div. there is a button.



<div id="topBar"> <a href ="#" onclick="load_home()"> HOME </a> </div>
<div id ="content"> </div>
<script>
function load_home(){
document.getElementById("content").innerHTML='<object type="type/html" data="http://www.google.com" ></object>';
}
</script>
</div>

molendijk
03-31-2017, 03:38 PM
That's because certain sites (Google, Facebook ...) can't be embedded in an iframe or object. Replace data="http://www.google.com" with data="http://www.dynamicdrive.com" and you'll see what I mean.
Btw, type="type/html" should be type="text/html".

jscheuer1
03-31-2017, 03:45 PM
It's a little unclear what you want. It sounds like you want your page to look and act like it's the other page. That's often a violation of the other site's copyright and/or its terms of service. Because of that, other sites will sometimes even have code to prevent it. But if you have permission to do it and the other site permits it from a code point of view, it's possible. In fact, if the other site explicitly sets an origin header that allows it, you can import its content via AJAX. Few sites do that though unless they want you to do what you are asking for, and it must be set on the server side.

See also:

http://www.dynamicdrive.com/forums/showthread.php?73827-Java-Script-for-cycling-through-pages&p=321192#post321192

molendijk
03-31-2017, 05:48 PM
Jonnyfreak are you looking for something like this (http://mesdomaines.nu/eendracht/location_search2)? If so, follow the instructions given on my demo site.

jonnyfreak
03-31-2017, 08:07 PM
It's a little unclear what you want. It sounds like you want your page to look and act like it's the other page. That's often a violation of the other site's copyright and/or its terms of service. Because of that, other sites will sometimes even have code to prevent it. But if you have permission to do it and the other site permits it from a code point of view, it's possible. In fact, if the other site explicitly sets an origin header that allows it, you can import its content via AJAX. Few sites do that though unless they want you to do what you are asking for, and it must be set on the server side.

See also:

http://www.dynamicdrive.com/forums/showthread.php?73827-Java-Script-for-cycling-through-pages&p=321192#post321192


sorry i should have explained it more. The divs are only 300px by 300px and displaying thumbnails of webpages that will have links the the said webpages

jscheuer1
03-31-2017, 10:33 PM
Oh, you can't really do that with just javascript I don't think. There are server side programs for that (none free that are any good I'm aware of, though I haven't looked into it for some time*), or you could just make your own thumbnail images and link them in the normal manner.


* A while back I experimented with one that used PHP's GD image library and a virtual incidence of the IE browser (version 8 back then, so that wouldn't work any longer, not sure if any browser today would be applicable), to generate a "real time" (that was the issue, took too long) thumbnail.