M
M
Michael2018-10-24 19:56:23
JavaScript
Michael, 2018-10-24 19:56:23

How to track the development of the Telegram widget?

I want to make authorization using the Telegram widget.
As planned, the authorization page is completely tied to the Telegram widget. That is, there is a header, footer and the actual widget + some little things for design.
The widget is connected via

<script asinc src="https://telegram.org/js/telegram-widget.js?4" data-telegram-login="OneBot" data-size="large"  data-auth-url="https://onesite.com/auth" data-request-access="write"></script>

Until the widget is displayed (and this may take several seconds) - it is empty in its place.
If the case takes place in Russia and without a VPN, then the widget will not appear at all.

Essence of the question: Is there any way to track the fact that the widget has been worked out? So that you can bind to this event (show the wait indicator for these few seconds until the widget is displayed, or issue some kind of message if the display did not happen)

Perhaps the question is completely lamer, if so, I apologize.
Anyway, thanks in advance for your reply x)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2018-10-24
@m-009

Perhaps something like this:

var check_widget = setInterval(()=>{
   if (window.__parseFunction) {
      alert('Telegram widget found!');
      clearInterval(check_widget);
   }
}, 500);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question