← Desenvolvimento

Alerta ao usar IE

Lida 2645 vezes

Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Boa tarde.

Já vi por ai um link para um script que o Google disponibilizava, igual ao que usam no YouTube que mostra um alerta se estiver a ser usado o IE6 ou 7.

Eu precisava disso, mas não encontro. Preferia que o alerta fosse dado sempre que usassem o IE, independentemente da versão.

Alguém tem alguma coisa do género?

Offline

anjo2 
Membro
Mensagens 3020 Gostos 0
Troféus totais: 31
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

Código: [Seleccione]
if(preg_match('/MSIE [6-7]/', $_SERVER['HTTP_USER_AGENT'])) echo "IE";Adaptei, mas deve estar a funcionar bem, se for o 6 ou o 7 ele mostra IE, é só mostrares o que está no IE para a mensagem que queres
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Obrigado ;)

Editado:
Anjo, só uma outra coisa. É suposto a mensagem ser mostrada apenas no IE 6/7 ou em todos?
Offline

anjo2 
Membro
Mensagens 3020 Gostos 0
Troféus totais: 31
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

ali é no IE6 ou 7 apenas, queres em todos?
Offline

euluism 
Membro
Mensagens 975 Gostos 0
Feedback +4

Troféus totais: 26
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1 500 Posts

Também precisava disso
Offline

tonebiclas 
Membro
Mensagens 29 Gostos 0
Troféus totais: 16
Trófeus: (Ver todos)
Super Combination Combination Level 3 Level 2 Level 1 10 Posts First Post Karma Eighth year Anniversary Seventh year Anniversary

em HTML:


<!--[if lt IE 7]>
<div>ie6</div>
<![endif]-->
<!--[if IE 7]>
<div>ie7</div>
<![endif]-->
<!--[if IE]>
<div>qualquer IE</div>
<![endif]-->


cumps ;)
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

ali é no IE6 ou 7 apenas, queres em todos?
Não, queria só nesses dois. Mas também está a aparecer no IE8.

em HTML:


<!--[if lt IE 7]>
<div>ie6</div>
<![endif]-->
<!--[if IE 7]>
<div>ie7</div>
<![endif]-->
<!--[if IE]>
<div>qualquer IE</div>
<![endif]-->


cumps ;)
Vou experimentar ;)

EDIT: Tonebiclas, funciona :) Obrigado!
Offline

anjo2 
Membro
Mensagens 3020 Gostos 0
Troféus totais: 31
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

mete aqui como estás a por, eu testei com os 3 e funciona bem, por isso estás a fazer algo mal, será que te estás a esquecer de por parêntesis?
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

mete aqui como estás a por, eu testei com os 3 e funciona bem, por isso estás a fazer algo mal, será que te estás a esquecer de por parêntesis?
Coloquei num ficheiro em branco, só com com as aspas (<?php e ?>).

EDITADO: Tonebiclas, isso não funciona para o IE6. E não percebo como há gente a usar o IE6! Nem dá para usar o Google!
Offline

anjo2 
Membro
Mensagens 3020 Gostos 0
Troféus totais: 31
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

Mas só aquela linha? coloca aqui o código do ficheiro
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Sim Anjo, só aquela linha.
É um ficheiro em  branco para experimentar: http://atuamusica.com/teste.php


Código: [Seleccione]
<?php
if(preg_match('/MSIE [6-7]/'$_SERVER['HTTP_USER_AGENT'])) echo "
<script language=\"JavaScript\">
alert('ACTUALIZE O SEU BROWSER');
</script>"
;
?>
Offline

Ricardo75 
Membro
Mensagens 1660 Gostos 0
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

EDITADO: Tonebiclas, isso não funciona para o IE6. E não percebo como há gente a usar o IE6! Nem dá para usar o Google!

Se é exclusivamente para IE6 podes usar assim:
Código: [Seleccione]
<!--[if IE 6]>
     MUDA-ME ESSA M###A DE BROWSER
<![endif]-->

Já agora, o lt quer dizer LESS THAN (Menor que) e podes usar também o lte = LESS THAN or EQUAL to (Menor ou igual a). Tal como em vez de lt e lte existe o gt e o gte (greater than, greater than or equal to)
Offline

Thomato 
Membro
Mensagens 4125 Gostos 3
Feedback +2

Troféus totais: 28
Trófeus: (Ver todos)
Apple User Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2

Já está a funcionar como quero :)
Obrigado a todos ;)