skip to Main Content

[Telegram.WebApp] Changing swipes behavior is not supported in version 6.0

<script src="https://telegram.org/js/telegram-web-app.js"></script>

I’m currently using the Telegram functions and noticed that when I visit the link above, the web app version is set to 6.0. Is there a way to update it to the latest version so that I can access the new functions?

Thank you!

2

Answers


  1. Initial params for this script are set from:

    1. location params (but you have to specify the params in your url).
    2. Session Storage. So you can setup session storage before tg script loading:
    <script>
      function sessionStorageSet(key, value) {
        try {
          window.sessionStorage.setItem('__telegram__' + key, JSON.stringify(value));
          return true;
        } catch (e) {}
        return false;
      }
    
      function sessionStorageGet(key) {
        try {
          return JSON.parse(window.sessionStorage.getItem('__telegram__' + key));
        } catch (e) {}
        return null;
      }
    
      var appTgVersion = 7.0;
    
      var initParams = sessionStorageGet('initParams');
      if (initParams) {
        if (!initParams.tgWebAppVersion) {
          initParams.tgWebAppVersion = appTgVersion;
        }
      } else {
        initParams = {
          tgWebAppVersion: appTgVersion
        };
      }
    
      sessionStorageSet('initParams', initParams);
    </script>
    
    <script src="https://telegram.org/js/telegram-web-app.js"></script>
    Login or Signup to reply.
  2. Based on my observation, the version number of telegram-web-app.js is still 7.6. You can use the magic code below to disable vertical scrolling before it gets updated by Telegram.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search