Posted By

knedle on 04/22/10


Tagged

javascript jquery ie6 alert browsers


Versions (?)

jQuery: IE6 alert


 / Published in: jQuery
 

URL: http://blog.3tecky.cz/sklad/ie6alert-500.jpg

this function check browser type and version \r\n\r\nif browser is ie6, display on top of page red box with \"ie6 hate text\" + links to download page new browsers

  1. jQuery.ie6Alert = function(mainText) {
  2. if($.browser.msie && $.browser.version=="6.0") {
  3. // if($.browser.msie && $.browser.version <= 6 )
  4. var links =
  5. '<div>Nainstalujte si: ' // install
  6. + '<a href="http://www.microsoft.com/ie8/">IE8</a> nebo ' // ie8 or
  7. + '<a href="http://www.mozilla-europe.org/cs/firefox/">Firefox</a> nebo ' // firefox or
  8. + '<a href="http://www.opera.com/download/">Operu</a> nebo ' // opera or
  9. + '<a href="http://www.google.com/chrome/">Chrome</a> nebo ' // chrome or
  10. + '<a href="http://www.apple.com/safari/download/">Safari</a> ' // safari
  11. + '- proste neco novejsiho...</div>'; // simple another new browser
  12. var html = '<div class="ie6alert">' + mainText + links + '</div>'
  13. $("body").prepend(html)
  14. // add css to div.ie6alert
  15. $('.ie6alert')
  16. .css("color", "#D8000C")
  17. .css("border", "0")
  18. .css("border-bottom", "1px solid")
  19. .css("margin", "0")
  20. .css("padding", "1em 5em")
  21. .css("font", "normal 2em Helvetica, Arial, sans-serif")
  22. .css("text-align", "center")
  23. .css("background-color", '#FFBABA');
  24. // add css to div with links
  25. $('.ie6alert div')
  26. .css('margin-top', '10px')
  27. .css("font-size", "0.5em");
  28. // add css to link
  29. $('.ie6alert div a')
  30. .css('color', '#D8000C')
  31. .css('font-weight', 'bold')
  32. .css('letter-spacing', '0.1ex');
  33. }
  34. }
  35.  
  36. // start with
  37.  
  38. $(document).ready(function(){
  39. $.ie6Alert('This web hate IE6, browser from year 2001...');
  40. });

Report this snippet  

You need to login to post a comment.