The polyfill mentioned and linked in the article has a cleverer solution. It attempts to render the same flag emoji in two different text colors and checks if they end up being the same color or not (same color = probably a color glyph, ie an emoji).
https://github.com/talkjs/country-flag-emoji-polyfill/blob/5...