polyfills are a way to use modern code in old browsers, but knowing exactly what to treat is a lot difficult to Mozilla has created Polyfill as a Service .
It works basically like this; you insert a script whose URL points to this service, and next to the script request the browser sends the user-agent header that identifies which browser the user is using, and based on this information is served a script that makes the polyfill of the modern functionalities that your browser does not contemplate.
Unlike the modernizr that only detects the features that are missing this service does fill in the gaps .
If you want to hack the project the repository in GitHub is the one here; link
I have not tested this service but it seems to me WELL promising.