TelegramMessenger / Telegram-iOS

Telegram-iOS
5.54k stars 1.49k forks source link

User-agent not represent that this is Telegram when opening links #736

Open NikitaKA opened 2 years ago

NikitaKA commented 2 years ago

Checklist

Description

We're developing PWA and when user opens link from Telegram it opens in in-app browser (which is similar to regular Safari) and there is no "Add to Home Screen" button in Share menu. We want to ask user to open that link in Safari, but we cannot detect if he is in Telegram in-app browser.

Expected Behavior

User-agent represents that this is Telegram (like in Facebook/Instagram apps): Mozilla/5.0 (iPhone; CPU iPhone OS 15_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Mobile/15E148 Safari/604.1 Telegram 3.6.1123

Example: Facebook Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12D508 [FBAN/FBIOS;FBAV/27.0.0.10.12;FBBV/8291884;FBDV/iPhone7,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/8.2;FBSS/3; FBCR/vodafoneIE;FBID/phone;FBLC/en_US;FBOP/5]

Instagram Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Instagram 93.0.0.14.101 (iPhone10,4; iOS 12_2; en_US; en-US; scale=2.00; gamut=normal; 750x1334; 153868846)

Actual Behavior

User-agent is same as regular Safari.

Steps to Reproduce

  1. Open link from message (https://www.whatismybrowser.com/detect/what-is-my-user-agent/ for example).
  2. Check user-agent.

Environment

Device: iOS iOS version: all versions App version: all version

shivanraptor commented 2 years ago

Why does the Telegram need to use its own User Agent? The in-app browser is not written by Telegram anyways, it's a Safari.

Facebook & Instagram's in-app browsers are made by the company themselves, therefore they use custom user agent strings.

martinklepsch commented 1 year ago

On reason it is actually very useful to be able to detect whether a site was opened in the Telegram web browser:

I'm honestly a bit surprised that this isn't something that has been considered, it seems like a lot of people / their users must be running into this?

nikravi commented 1 year ago

I have a similar issue: the in-app browser is not sharing the same localStorage as the full Safari, so it breaks a critical user flow. If telegram would have a specific user agent, we can advise users to use Safari for full experience or just 'Add to Homescreen'.

duckdegen commented 7 months ago

Bumping this

apozdeyev commented 2 months ago

Bumping this

xstelea commented 1 month ago

Bump

sh1kxrv commented 1 month ago

Bump

wesleyleandropzk commented 1 week ago

Bump