BtnOpen

Os dejo un código muy útil que detecta el tipo de navegador y su versión:

1. // Browser detection

2.3. // Internet Explorer

4. var ie  = document.all != null;  //ie4 and above

5. var ie5 = document.getElementById && document.all;

6. var ie6 = document.getElementById && document.all&&(navigator.appVersion.indexOf("MSIE 6.")>=0);

7.

8. // Netscape

9. var ns4 = document.layers != null;

10. var ns6 = document.getElementById && !document.all;

11. var ns  = ns4 || ns6;

12.

13. // Firefox14. var ff  = !document.layers && !document.all;

15.

16. // Opera17. var op  = navigator.userAgent.indexOf("opera")>0;

18. var op7 = op && operaVersion() <= 7;

19. var op8 = op && operaVersion()>= 8;

20.

21. // Detects the Opera version

22. function operaVersion() {

23. agent = navigator.userAgent;

24. idx = agent.indexOf("opera");

25. if (idx>-1) {

26. return parseInt(agent.subString(idx+6,idx+7));

27.}

28.}

Vía | informatica-practica.net


Deja un comentario


Add to Technorati Favorites BlogESfera Directorio de Blogs Hispanos - Agrega tu Blog