fix: загрузка Telegram Login Widget через JS interop для корректной работы с Blazor SPA-навигацией
This commit is contained in:
@@ -22,6 +22,21 @@
|
||||
<Routes @rendermode="InteractiveServer" />
|
||||
<ReconnectModal />
|
||||
<script src="@Assets["_framework/blazor.web.js"]"></script>
|
||||
<script>
|
||||
window.loadTelegramWidget = function (botUsername, authUrl) {
|
||||
var container = document.getElementById('telegram-login-container');
|
||||
if (!container) return;
|
||||
container.innerHTML = '';
|
||||
var script = document.createElement('script');
|
||||
script.async = true;
|
||||
script.src = 'https://telegram.org/js/telegram-widget.js?22';
|
||||
script.setAttribute('data-telegram-login', botUsername);
|
||||
script.setAttribute('data-size', 'large');
|
||||
script.setAttribute('data-auth-url', authUrl);
|
||||
script.setAttribute('data-request-access', 'write');
|
||||
container.appendChild(script);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user