Telegram-iOS
Telegram-iOS copied to clipboard
User-agent not represent that this is Telegram when opening links
Checklist
- [ ] I am reporting an issue in existing functionality that does not work as intended
- [x ] I've searched for existing GitHub issues
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
- Open link from message (https://www.whatismybrowser.com/detect/what-is-my-user-agent/ for example).
- Check user-agent.
Environment
Device: iOS iOS version: all versions App version: all version
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.
On reason it is actually very useful to be able to detect whether a site was opened in the Telegram web browser:
- imagine a site using Telegram's Login Widget
- the link to the site is shared via Telegram
- a user clicks the link, then clicks the login button
- to accept the login they have to close the browser to access their Telegram messages
- this resets the login flow and they will be back at the start when they click the link to the site again
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?
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'.
Bumping this
Bumping this
Bump
Bump
Bump
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.
This is needed as the in-app browser of Telegram has a different session state than e.g. Safari. If users log in on a site like Twitter, but then they open Twitter by clicking on a link within Telegram, Twitter presents as if they are logged out, which is confusing.
A user agent that signifies that the web site is loaded in the Telegram browser could enable devs to show a warning saying that they're in the inapp browser and that their sessions may not apply there.