DETECTAR NAVEGADOR Y DEFINIR CSS POR NAVEGADOR JAVASCRIPT


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script>
  2. //WEBKIT == CHROME
  3. if ($.browser.webkit) {
  4. document.write("HOLA CHROME");
  5. }else if ($.browser.msie){
  6. if ($.browser.version>=7){
  7. if(screen.width<=1024){
  8. document.write("<link rel='stylesheet' type='text/css' href='http://universitarios.cl/universidades/images/2011/style.css' />");
  9. }
  10. if((screen.width>=1088)&&(screen.width<=1360)){
  11. document.write("<link rel='stylesheet' type='text/css' href='http://universitarios.cl/universidades/images/2011/css_1280_1360.css' />")
  12. }
  13. if(screen.width>=1600){
  14. document.write(" <link rel='stylesheet' type='text/css' href='http://universitarios.cl/universidades/images/2011/1600.css' media='screen' />");
  15. }
  16. }else{
  17. document.write("HOLA INTENET EXPLORER 6");
  18. }
  19. }else if ($.browser.mozilla) {
  20. if((screen.width<=1024)) {
  21. document.write("<link rel='stylesheet' type='text/css' href='http://universitarios.cl/universidades/images/2011/style.css' />");
  22. }
  23. if((screen.width>=1088)&&(screen.width<=1360)) {
  24. document.write("<link rel='stylesheet' type='text/css' href='http://universitarios.cl/universidades/images/2011/css_1280_1360.css' />");
  25. }
  26. if(screen.width>=1600){
  27. document.write("<link rel='stylesheet' type='text/css' href='http://universitarios.cl/universidades/images/2011/1600.css' />");
  28. }
  29. }
  30. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.