Serve different JS files, depending on browser support?
That's how Caja currently deploys. If feature detection says the browser adequately implements ES5, we deploy the (approximately no translation) SES-on-ES5 implementation.
Otherwise we fall back to Caja's ES5-to-ES3 translator (ES5/3) and runtime.
You can see the effect by visiting caja.appspot.com and watching the menu whose state starts in "Autodetect Mode" and then switches to either "ES5 Mode" or "ES5/3 Mode" depending on this autodetection decision. It is a menu so that you can also override this by manually forcing the choice you'd like.
As you can see from repairES5.js, the autodetection is tricky because browsers only gradually implemented more and more of ES5 and few implement it completely. But the autodetection has to judge when they implement enough to be considered an ES5 browser. I expect the same will be true for the ES5 to ES6 transition.
You can also see the outcome of the individual tests used in this autodetection at google-caja.googlecode.com/svn/trunk/src/com/google/caja/ses/explicit.html, or by watching the console when visiting caja.appspot.com.
Conditionally loading modules is also built into YUI. For example, when you want to use JSON, YUI checks if the native version is present and if not it loads a JS implementation.
You have to do it feature by feature. I recently wrote a Taskjs like generators+promises implementation and it checks which syntax is supported (ES6 or the old Firefox one without function*) by using eval() and catching syntax errors. See juandopazo/yui3-task/blob/master/js/task.js#L43-L55. It doesn't load a new module based on that check because the code is not big enough to warrant loading a whole new script.
In principle, you could serve different files to different browsers:
What is the best way to do this?