Navigator Object & detecting Plugins

and some others like history object

by Mehmetcan Sinir

JavaScript

console.log(navigator.platform);
console.log(navigator.onLine);
console.log(navigator.language);

//detecting whether a browser has a particular plugin installed

function hasPlugin(nameOfPlugin) {
    nameOfPlugin = nameOfPlugin.toLowerCase();
    for(var i = 0; i < navigator.plugins.length; i++) {
        if (navigator.plugins[i].name.indexOf(nameOfPlugin) > -1) {
            return true;
        } else {
            return false;
        }
    }
}

//detecting Flash
console.log(hasPlugin("flash"));//returns false, flash plugin is not installed

console.log(history.length);