if (typeof window.TelegramWebview !== 'undefined') { console.log('Found Telegram Webview'); }
8yo question but appears on Google. Thanks to mujeebcpy on github.