Modernizr : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

Modernizr

A free Javascript library. The current version is 3.5.0 Last revised/verified: 2017-04-14. You can prune it down to just the features you need. You can also read the uncompressed, commented development version. It it does many different tests on browser capabilities and put a form that you can use them in your CSS (Cascading Style Sheets) style sheets.

Unfortunately there are no detects for brand of browser. I understand purists consider detecting and using the brand of browser wicked. It never occurred to them that if you give instructions on how to use the browser, they depend on the browser and version, not capabilities.

How It Works

The trick to how it works and communicates with CSS is elegant. You load its JavaScript library, by inserting a line like this in the header:

<head>
...
<!-- load modernizr library in the header -->
<script src="modernizr-1.1.js"></script>
...
</head>

and it does various binary tests of capabilities. Then for every capability that exists, it applies a style with the name of that capability to your body tag e.g. .csscolumns. For every capabilitity that does not exist, it applies a style to your body tag with the name of that capability, with the letters no- prefixed, eg. .no-csscolumns. Now, using garden variety CSS, you use these styles in your rules to create variants for when the capability is present or absent. You can use display:none to hide text. In addition it creates a JavaScript object called Modernizer with boolean fields for all the capabilities.

One strategy might be to examine their open source, then write your own JavaScript code monkey-see, monkey-do fashion.


This page is posted
on the web at:

http://mindprod.com/jgloss/modernizr.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\modernizr.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[18.119.139.50]
You are visitor number