omg, I feel so stupid for asking this html question...

Indiigo007

Junior Member
Joined
Nov 11, 2009
Messages
189
Reaction score
191
If I want to use example.com to show the entire contents of www.google.com -- as if you were AT google.com except it says www.example.com in the address bar (and I could add info in the header) -- what code would I need to accomplish this on example.com.

Basically a frame that is 100% of the browser.

Why can't I figure this out?!? Thanks to anyone that can help.
 
Code:
<body>
<p><iframe name="I1" width="100%" height="100%" src="[URL]http://www.the-big-G.com/[/URL]">
This is 2012, get a new browser already!
</iframe></p>
</body>

that should do it.
 
Do it with PHP

PHP:
$url = "http://www.example.com";
$str = file_get_contents($url);
echo $str;

Or

PHP:
		function get_url_contents($url){
			$kurl = curl_init();
			$timeout = 10;
			curl_setopt ($kurl, CURLOPT_URL,$url);
			curl_setopt ($kurl, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt ($kurl, CURLOPT_CONNECTTIMEOUT, $timeout);
			$results = curl_exec($kurl);
			curl_close($kurl);
			return $results;
		}
		
		$url = "http://www.google.com";
		echo get_url_contents($url);
 
I'd use file_get_contents or Curl, as said above. It's not very hard either, just google some and you'll find out how to do it :)
 
I'm not sure about Iframing G$$gle because they have some heavy duty restrictions on iframes.

However if you are trying to set the height of an element to 100%, embed jquery in your page and then put this in script tags in your head:
Code:
var windowHeight = $(window).height(); 
$(window).load(function(){
    $('.className').css({'height':(windowHeight) + 'px'});
});
$(window).resize(function(){
    var windowHeight = $(window).height(); 
    $('.className').css({'height':(windowHeight) + 'px'});
});

Reason being is that browsers don't consider 100% as being a valid height value, unless the element is inside a parent element that already has a defined height. Annoying stuff sometimes. Also you probably want to set the padding to 0px for the element with css.

Hope this helps (somehow)
 
Last edited:
Its not possible to do what you are wishing with iFrame!
 
Depends on the site.

Iframing major websites is likely not possible as it is possible for an iframed website to remove itself from being iframed. Many major websites incorporate this.
Using a fetch request on certain sites is also not possible, like google. After a certain amount of requests in a short period you will be considered a bot.

Iframing is however the best choice if its possible to do. Cookies are stored locally on the users machine whereas with a fetch request you will need to create a database to store the session.
 
Back
Top