开发者

Unsupported browser notification in rails

开发者 https://www.devze.com 2023-03-21 11:35 出处:网络
I\'m using ruby on rails to develop this webapp that only supports the latest browser. How do i show a pop-up message when user is using unsupported browser.

I'm using ruby on rails to develop this webapp that only supports the latest browser.

How do i show a pop-up message when user is using unsupported browser. The message will show when the page is not loaded in the following browser:开发者_JAVA技巧

  1. Firefox 4 and above
  2. IE9 and above
  3. Safari 5 and above
  4. Chrome 10 and above


jQuery Browser Rejection Plugin can help you. it supports following browsers disable/enable options:

        msie: false,msie5: true,msie6: true,msie7: false,msie8: false, // MSIE Flags (Global, 5-8)
        firefox: false,firefox1: false,firefox2: false,firefox3: false, // Firefox Flags (Global, 1-3)
        konqueror: false,konqueror1: false,konqueror2: false,konqueror3: false, // Konqueror Flags (Global, 1-3)
        chrome: false,chrome1: false,chrome2: false,chrome3: false,chrome4: false, // Chrome Flags (Global, 1-4)
        safari: false,safari2: false,safari3: false,safari4: false, // Safari Flags (Global, 1-4)
        opera: false,opera7: false,opera8: false,opera9: false,opera10: false, // Opera Flags (Global, 7-10)
        gecko: false,webkit: false,trident: false,khtml: false,presto: false, // Rendering Engines (Gecko, Webkit, Trident, KHTML, Presto)
        win: false,mac: false,linux : false,solaris : false,iphone: false, // Operating Systems (Win, Mac, Linux, Solaris, iPhone)
        unknown: false // Unknown covers everything else


It is very simple using jreject_rails gem

Just need to call function into your javascript file.

$(function() { $.reject({ reject: { msie5: true, msie6: true, msie7: true } }); });

Make those versions true which your site don't support.

Let me know If you any issue to implement. It works for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消