Skip to content

Instantly share code, notes, and snippets.

@eiriarte
Created September 24, 2018 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiriarte/19098601221aa047e654d9846716af68 to your computer and use it in GitHub Desktop.
Save eiriarte/19098601221aa047e654d9846716af68 to your computer and use it in GitHub Desktop.
Función sencillita, pero sofisticada, que se puede usar para mostrar el típico aviso de "navegador obsoleto".
/**
* Comprueba si el navegador es compatible con alguna de las propiedades CSS
* especificadas.
* @param {Array}<String> props - propiedades CSS a comprobar
* @returns {boolean} true si el navegador es compatible, false si no lo es
*/
function obsoleto(props) {
if (!props) {
// Por defecto usamos border-image (no funciona en IE10, sí en IE11)
props = [ 'borderImage', 'WebkitBorderImage' ];
}
var div = document.createElement('div');
for (var i = 0; i < props.length; i++) {
if (props[i] in div.style) { return false; }
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment