Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
how to check browser version and set alert

I want to create code which will auto get the user's browser version and check it , if it was for example less than 50 popup alert which say "You can not access to this website(Update your Browser)" and open error page.

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

This is the other solution :

navigator.sayswho= (function(){
var ua= navigator.userAgent;
var tem; 
var M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
    tem=  /\brv[ :]+(\d+)/g.exec(ua) || [];
    return 'IE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
    tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
    if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');})();

alert(navigator.sayswho);

about 4 years ago · Juan Pablo Isaza Relatório

0

You can use Browser detect which gives you information regarding your browser and versions

alert(BrowserDetect.browser);
alert(BrowserDetect.version);

Another option is using navigator.appVersion but it was deprecated lately

alert(navigator.appVersion);

about 4 years ago · Juan Pablo Isaza Relatório

0

Why not just do that serverside prior to even delivering the page ? The HTTP request often includes a user agent header (which is the browser brand/version/etc).

The exact implementation depends on what exactly your "site" is and on what type of webserver it runs.

If it's a PHP application then you could use $_SERVER['HTTP_USER_AGENT'].

If the site uses plain old static .html files and runs on Apache httpd, then you could use RewriteCond %{HTTP_USER_AGENT} ...something...

and so on.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda