To use the Web MIDI API Polyfill
Just include
<script src='https://cwilso.github.io/WebMIDIAPIShim/build/WebMIDIAPI.min.js'></script>
in your HTML source.
Test it out!
Before you press the button: install the Jazz-Soft.net's Jazz-Plugin, version 1.4 or higher to enable MIDI support on Windows, OSX and Linux.
You will also want some MIDI input/output devices - MacOS and Windows typically have output software synthesizers installed by default. On MacOS, if you want a software input device you may want to install MidiKeys.