Advertisement
fenidaz

Untitled

Nov 22nd, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. var getBrowserInfo = function() {
  2. var ua = navigator.userAgent,
  3. tem,
  4. M =
  5. ua.match(
  6. /(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i
  7. ) || [];
  8. if (/trident/i.test(M[1])) {
  9. tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
  10. return 'Internet explorer-' + (tem[1] || '');
  11. }
  12. if (M[1] === 'Chrome') {
  13. M[1] = 'Google Chrome';
  14. tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
  15. if (tem != null)
  16. return tem
  17. .slice(1)
  18. .join('-')
  19. .replace('OPR', 'Opera');
  20. }
  21.  
  22. M = M[2]
  23. ? [M[1], M[2]]
  24. : [navigator.appName, navigator.appVersion, '-?'];
  25. if ((tem = ua.match(/version\/(\d+)/i)) != null)
  26. M.splice(1, 1, tem[1]);
  27. return M.join('-');
  28. };
  29. an = getBrowserInfo();
  30. var datos = an.split('-');
  31. navegador = datos[0];
  32.  
  33. if ((navegador == 'Internet explorer') || (navegador == 'Safari')) {
  34. console.log('redireccionar');
  35.  
  36. }else{
  37. console.log("te quedas");
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement