Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/12/2011, 15:58
Avatar de Locky20
Locky20
 
Fecha de Ingreso: octubre-2011
Mensajes: 9
Antigüedad: 12 años, 6 meses
Puntos: 0
Ajustar alto de iframe

Bueno hace un tiempo estoy dandole vueltas a poder resolver lo de crear un iframe que se ajuste a la altura y ancho de una web automaticamente, por ahi cirulan un monton de trucos con javascript y demas pero ninguno es lo suficientemente "potente", ahora he encontrado una pagina que lo hace perfectamente y es la redireccion de taringa, por ejemplo si entramos a http://links.itaringa.net/go?http://download.mp3tag.de/mp3tagv243setup.exe el iframe se acomoda perfectamente y al navegar en la pagina huesped, el tamaño tambien se adecua perfectamente

del codigo fuente se puede sacar esto

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es" >
	<head profile="http://purl.org/NET/erdf/profile">
		<meta http-equiv="X-UA-Compatible" content="chrome=1" />
		<link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
		<link rel="schema.foaf" href="http://xmlns.com/foaf/0.1/" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Este sitio no tiene relación con Taringa!</title>
		<link href="/links/style.css" rel="stylesheet" type="text/css" />

		<link rel="shortcut icon" href="http://o1.t26.net/images/favicon.ico" type="image/x-icon" />
		<link rel="apple-touch-icon" href="http://o1.t26.net/images/apple-icon.png" />
		<link rel="search" type="application/opensearchdescription+xml" title="Taringa!" href="http://www.taringa.net/lab/opensearch/taringa.xml" />
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
		<script type="text/javascript">var x=location.href.split('?');u='';if(x.length>1){x.shift();u=x.join('?');if(!u.match(/^https?:\/\//))u=''}if(u.match(/^(?:.*?\.)?(?:i?taringa|poringa)\.net(?:\/.*)?$/))location.href=u</script>
	</head>
	<body>
		<div class="taringa-bar">

			<div class="taringa-wrapper ">
				<div class="taringa-logo floatL">
					<h1 onclick="location.href='http://www.taringa.net'">Taringa!</h1>
				</div>		
				<div class="share-bar floatL">
					<ul>
						<li class="twitter"><a class="icons16" onclick="location.href='http://twitter.com/?status='+location.href">Twitter</a></li>
						<li class="facebook"><a class="icons16" onclick="location.href='http://www.facebook.com/sharer.php?u='+location.href">Facebook</a></li>

					</ul>
				</div>
				<div class="floatL">
					<span class="caption">Este sitio no tiene relación con Taringa! No revele sus contraseñas.</span>
				</div>
				<a href="http://www.wiroos.com/" class="floatL" target="_blank" style="padding:10px 15px 9px 15px" title="Web Hosting - Alojamiento Web - WIROOS Internet Hosting">
					<img src="/links/wiroos.png" />
				</a>

				<div class="logout-bar floatR">
					<a class="icons16" onclick="location.href=document.getElementById('external').src"></a>
				</div>
			</div>
		</div>
		<iframe id="external" src="about:blank" frameborder="0"></iframe>
		<script type="text/javascript">if(u){alert('Usted está saliendo de Taringa!');document.getElementById('external').src=u}else{location.href='http://www.taringa.net'}$(window).bind('resize',function(){var f=document.getElementsByTagName('iframe')[0];f.style.height=(document.documentElement.clientHeight - f.offsetTop)+'px'});$(window).trigger('resize')</script>
	</body>

</html> 
La parte interesante es del frame <iframe id="external" src="about:blank" frameborder="0"></iframe>

supongo entonces que el php esta influyendo pero no se me ocurre como?

Alguna idea

Salu2