Sidebearings in a webfont

Not a specifically Glyphs related question, but maybe someone here can help me. Is there any way to read the sidebearings of a glyph in a webfont? Like for example with javascript? I’m looking to make some optical margin alignments and this would help a lot.

Have a look at the OpenType.js library.

Thanks, it seems like this might work!