Skip to content

[Bug]: isTMA returns invalid value when opening a link in the Telegram in-app browser on iOS #747

@nikitaprokopov

Description

@nikitaprokopov

Telegram Application

Telegram for Android, Telegram for iOS

Describe the Bug

When a user opens a link to our web app from Telegram on iOS, the app fails to load. Telegram opens the link in its built-in browser. However, the Telegram SDK's isTMA check incorrectly returns true, leading the app to assume it's running inside TMA and proceed with code that depends on the full TMA context - which causes a failure.

To Reproduce

Steps to reproduce the behavior:

  1. On an iPhone, open the Telegram app.
  2. Go to Settings > Data and Storage > Open Links In and select Telegram.
  3. Tap a link to https://tma-sdk-bug-reproduce.netlify.app in any Telegram chat.
  4. The link will open in the Telegram in-app browser.
  5. isTma = true

A reproduction repository is available here.

Expected Behavior

The isTMA should correctly detect that it's not running in a true TMA environment, even when opened inside the Telegram in-app browser.

If changing the behavior of isTMA is not possible due to backward compatibility concerns, then it would be very helpful to have an additional function in the Telegram SDK that allows developers to explicitly distinguish between:

  • The Telegram in-app browser (which is not a valid context for TMA logic)
  • A true TMA environment, and

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions