Foro de elhacker.net

Programación => Desarrollo Web => Mensaje iniciado por: Zeroql en 10 Septiembre 2011, 16:57 pm



Título: Incluir archivo si solo es IE6
Publicado por: Zeroql en 10 Septiembre 2011, 16:57 pm
Buenas
bueno tengo este incoveniente,
tengo una web que no me navega bien en IE6 y para no tener que rediseñarla para este navegador, he creado un archivo aparte con el siguiente codigo

Código
  1. <div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 78px; position: relative;'>
  2.    <div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'>
  3.     <a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'>
  4.        <img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Cierra este aviso'/></a>
  5.    </div>
  6.    <div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
  7.      <div style='width: 75px; float: left;'><img src='images/ie6/warning.jpg' alt='¡Aviso!'/></div>
  8.      <div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
  9.        <div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>Usted est&aacute; usando un navegador obsoleto.</div>
  10.        <div style='font-size: 12px; margin-top: 6px; line-height: 12px;'>Para navegar mejor por este sitio, por favor, actualice su navegador.</div>
  11.      </div>
  12.      <div style='width: 75px; float: left;'><a href='http://www.mozilla-europe.org/es/firefox/' target='_blank'>
  13.       <img src='images/ie6/firefox.gif' style='border: none;' alt='Descargar Firefox'/></a>
  14.      </div>
  15.      <div style='width: 75px; float: left;'>
  16.       <a href='http://www.microsoft.com/downloads/details.aspx?FamilyID=341c2ad5-8c3d-4347-8c03-08cdecd8852b&DisplayLang=es' target='_blank'>
  17.        <img src='images/ie6/ie.gif' style='border: none;' alt='Descargar la ultima version de Internet Explorer'/></a>
  18.      </div>
  19.      <div style='width: 73px; float: left;'><a href='http://www.apple.com/es/safari/download/' target='_blank'>
  20.    <img src='images/ie6/safari.gif' alt='Descargar Safari' style='border: none;'/></a>
  21.      </div>
  22.      <div style='float: left;'><a href='http://www.google.com/chrome?hl=es' target='_blank'>
  23.    <img src='images/ie6/chrome.gif' alt='Descargar  Google Chrome' style='border: none;'/></a>
  24.      </div>
  25.    </div>
  26. </div>
  27.  

y que en lap pagina web que navege y detecte que es IE6 incluirla

la incluia con iframe pero veo que cuando se cierra la ventana queda el marco
uso este codigo para detectar el IE
Código
  1. <!--[if lt IE 7]>><iframe src='ie6alert.html'/></iframe><![endif]-->
  2.  

alguien conoce de otro metodo para incluir archivos cunado se trata de ie6??

DE ANTE MANO MUCHAS GRACIAS.


Título: Re: Incluir archivo si solo es IE6
Publicado por: madpitbull_99 en 10 Septiembre 2011, 18:54 pm
Código:
<!--[if lt IE 7]>><iframe src='ie6alert.html'/></iframe><![endif]-->

Esa también se suele utilizar mucho, pero cambia IE7 por IE6.

Te recomiendo este artículo si quieres hacerlo mediante javascript o ASP: Detecting Internet Explorer More Effectively (http://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx) o este otro: About Conditional Comments (http://msdn.microsoft.com/en-us/library/ms537512.aspx).


A eso también se le llama "compilación condicional": Conditional Compilation of JScript/ javascript in IE (http://www.javascriptkit.com/javatutors/conditionalcompile.shtml).

Código:
<!--[if IE 6]>
Será interpretado sólo por IE6
<![endif]-->

<![if !IE 6]>
No será interpretado por IE6
<![endif]>

También puedes usar JQuery:

Código
  1. if($.browser.msie && $.browser.version=="6.0") alert("Estas usando IE6");

En PHP tienes muchas formas de hacerlo, desde expresiones regulares hasta funciones de manejo de cadenas, con regex se haría así:

Código
  1. if (preg_match('/\bmsie 6/i', $ua) && !preg_match('/\bopera/i', $ua))
  2.  echo "Estas usando IE6";


Título: Re: Incluir archivo si solo es IE6
Publicado por: Zeroql en 10 Septiembre 2011, 20:09 pm
madpitbull_99 muchas gracias he optado por la de php, aunque jquery me llama mucho la atencion, me gusta mas anivel servidor. gracias!!!