I'm curious, somehow I remebered as JS not getting executed when opening a html file from filesystem, but clearly that isn't the case since this works. Did this change? Maybe I'm just misremembering
If you send html to Telegram, the preview will not run js when the recipient opens it. I think Android and IOS work differently.