Foros del Web » Programando para Internet » Javascript »

firefox si > IE no

Estas en el tema de firefox si > IE no en el foro de Javascript en Foros del Web. saludes , quisiera que mi sitio web solamente cargara en Firefox, es decir, que algún script ubicado en el index.html me restringa el acceso de ...
  #1 (permalink)  
Antiguo 13/05/2009, 16:27
 
Fecha de Ingreso: febrero-2009
Ubicación: Medellín
Mensajes: 81
Antigüedad: 15 años, 2 meses
Puntos: 1
Pregunta firefox si > IE no

saludes,

quisiera que mi sitio web solamente cargara en Firefox, es decir, que algún script ubicado en el index.html me restringa el acceso de la página si el navegador utilizado por el visitante es el de Internet Explorer.


Gracias

  #2 (permalink)  
Antiguo 13/05/2009, 16:44
Avatar de pato12  
Fecha de Ingreso: septiembre-2007
Ubicación: Salta
Mensajes: 1.620
Antigüedad: 16 años, 7 meses
Puntos: 101
Respuesta: firefox si > IE no

Podrias hacer haci:
Código javascript:
Ver original
  1. if(!!(window.attachEvent&&navigator.userAgent.indexOf('Opera') === -1))// Creo que haci hace prototype
  2. alert('No se permite IE');
Pero no se como canselar que se carge la pagina :D, pero podrias hacer un div que oculte todo, si es IE no lo des ocultas, sino (else) lo desocultas.

Pero no seria mejor arreglar tu web para ie? porque muchas personas lo usan.
Suerte
Salu2
__________________
Half Music - www.halfmusic.com
  #3 (permalink)  
Antiguo 13/05/2009, 16:54
 
Fecha de Ingreso: mayo-2009
Ubicación: DF
Mensajes: 39
Antigüedad: 14 años, 11 meses
Puntos: 2
Respuesta: firefox si > IE no

Te recomiendo hacerlo con Mootools

Puedes checar los navegadores:

* Browser.Engine.trident - (boolean) True if the current browser uses the trident engine (e.g. Internet Explorer).
* Browser.Engine.gecko - (boolean) True if the current browser uses the gecko engine (e.g. Firefox, or any Mozilla Browser).
* Browser.Engine.webkit - (boolean) True if the current browser uses the webkit engine (e.g. Safari, Google Chrome, Konqueror).
* Browser.Engine.presto - (boolean) True if the current browser uses the presto engine (e.g. Opera 9).
* Browser.Engine.name - (string) The name of the engine.
* Browser.Engine.version - (number) The version of the engine. (e.g. 950)
* Browser.Plugins.Flash.version - (number) The major version of the flash plugin installed.
* Browser.Plugins.Flash.build - (number) The build version of the flash plugin installed.


Y si tienen explorer puedes redirigirlos a otro sitio asi

window.location = 'w w w . d o m i n i o . c o m'


A fin de cuentas seria un codigo asi:

if (Browser.Engine.trident){
window.location = 'h t t p://w w w . d o m i n i o . c o m /alternativa.html';
}

No olvides incluir la libreria de mootools core al inicio de tu pagina
  #4 (permalink)  
Antiguo 13/05/2009, 17:02
Avatar de Julcar  
Fecha de Ingreso: noviembre-2007
Ubicación: C:\inetpub\wwwroot\Guayaquil
Mensajes: 1.507
Antigüedad: 16 años, 5 meses
Puntos: 54
Respuesta: firefox si > IE no

Y si quisiera que solo ingresen los que usan internet explorer?
__________________
Linux no es el único S.O. libre, conoce a ReactOS el Windows Libre!
"Si mis respuestas te dan la calma, espárceme un poco de karma"
  #5 (permalink)  
Antiguo 13/05/2009, 17:10
 
Fecha de Ingreso: mayo-2009
Ubicación: DF
Mensajes: 39
Antigüedad: 14 años, 11 meses
Puntos: 2
Respuesta: firefox si > IE no

Seria la negacion de lo anterior, es decir esta condicionante

if (!Browser.Engine.trident){
window.location = 'h t t p://w w w . d o m i n i o . c o m /alternativa.html';
}
  #6 (permalink)  
Antiguo 13/05/2009, 17:13
Avatar de pato12  
Fecha de Ingreso: septiembre-2007
Ubicación: Salta
Mensajes: 1.620
Antigüedad: 16 años, 7 meses
Puntos: 101
Respuesta: firefox si > IE no

Un ejemplo para que no se carge con IE:
Código javascript:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>No IE</title>
  6. <script type="text/javascript">
  7. <!--
  8. onload=function(){
  9.     if(!(window.attachEvent&&navigator.userAgent.indexOf('Opera') === -1)){
  10.         document.getElementById('cartelMal').style.display='none';
  11.         document.getElementById('web').style.display='block';
  12.     }
  13. };
  14. -->
  15. </script>
  16. <style type="text/css">
  17. #cartelMal {
  18.     background-color: #FFD9D9;
  19.     padding: 5px;
  20.     border: 1px solid #FF0000;
  21. }
  22. </style>
  23. </head>
  24.  
  25. <body>
  26. <div id="cartelMal">Usa IE y no puedes ver esta web!</div>
  27. <div id="web" style="display:none;">No usas IE! que bien. ahora puedes ver esta web.<br />
  28. contenido<br />
  29. ...<br />
  30. ...<br />
  31. ...<br />
  32. ...<br />
  33. ...<br />
  34. ...<br />
  35. ...<br />
  36. ...<br />
  37. ...<br />
  38. ...<br />
  39. ...<br />
  40. ...<br />
  41. </div>
  42. </body>
  43. </html>
y si queres Julcar que solo se vea con IE, solo sacale el ! al if y cambia los carteles.
Suerte
Salu2
__________________
Half Music - www.halfmusic.com
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:42.