0

I am using the following toll to check for browser version accessing my website and display a message at the top to notify the user to update his browser: https://github.com/mikemaccana/outdated-browser

In the following example I am targeting < IE10 browsers.

<!-- plugin call -->
<script>
    //event listener form DOM ready
    function addLoadEvent(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                if (oldonload) {
                    oldonload();
                }
                func();
            }
        }
    }
    //call function after DOM ready
    addLoadEvent(function(){
        outdatedBrowser({
            bgColor: '#f25648',
            color: '#ffffff',
            lowerThan: 'IE10',
            languagePath: ''

        })
    });
</script>

Can I use the tool to detect a specific version of Firefox also in the lowerThan: field. If yes how should I proceed?

velvt
  • 143
  • 1
  • 3
  • 13

1 Answers1

0

I would recommend detecting individual features. Try initializing whatever you need and if it fails then display the message. You can test all your features in a startup function, or try initializing plugins and see if it fails.

for example:

function supportsWebAudio() {
    var hasWebKitAudio = 'webkitAudioContext' in window;
    var hasAudioContext = 'AudioContext' in window;

    if (!(hasWebKitAudio || hasAudioContext)) {
        var audioElement = document.createElement('audio');
        return audioElement.canPlayType;
    }
    return true;
} 
brianxautumn
  • 1,162
  • 8
  • 21
  • Unfortunately this is a requirement, I need to target by browser's version. – velvt Jul 20 '16 at 07:20
  • In that case you can check out http://stackoverflow.com/questions/11219582/how-to-detect-my-browser-version-and-operating-system-using-javascript – brianxautumn Jul 20 '16 at 07:24
  • But if you're using this to specifically test if your app will work on their browser I would still test if the feature is available. – brianxautumn Jul 20 '16 at 07:26
  • Yes it works as is but I also want to target Firefox and Chrome browsers. – velvt Jul 20 '16 at 07:43