Target Different Browsers


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



Copy this code and paste it in your HTML
  1. $(document).ready(function() {
  2. // Target Firefox 2 and above
  3. if ($.browser.mozilla && $.browser.version >= "1.8" ){
  4. // do something
  5. }
  6.  
  7. // Target Safari
  8. if( $.browser.safari ){
  9. // do something
  10. }
  11.  
  12. // Target Chrome
  13. if( $.browser.chrome){
  14. // do something
  15. }
  16.  
  17. // Target Camino
  18. if( $.browser.camino){
  19. // do something
  20. }
  21.  
  22. // Target Opera
  23. if( $.browser.opera){
  24. // do something
  25. }
  26.  
  27. // Target IE6 and below
  28. if ($.browser.msie && $.browser.version <= 6 ){
  29. // do something
  30. }
  31.  
  32. // Target anything above IE6
  33. if ($.browser.msie && $.browser.version > 6){
  34. // do something
  35. }
  36. });
  37.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.