Webogram: Register tg:// protocol

Created on 2 Dec 2014  ·  17Comments  ·  Source: zhukov/webogram

Currently, telegram.me/username forwards to tg://resolve?domain=username on Firefox desktop.

This page says webapps can register such protocols. So, if webogram registers the tg protocol, telegram.me will work on desktop too.

Most helpful comment

navigator.registerProtocolHandler("tg",
                                  "https://web.telegram.org/#/im?tgaddr=%s",
                                  "telegram Web App");

Works perfectly. So I didn't get what the problem is.
capture

All 17 comments

Thanks, will implement this as soon as will support resolving usernames

It turned out that we can only register web+tg protocol, which is not good enough.
But I managed to make links work with some server-side adjustments.

Since browsers do not allow registering the tg:// protocol, I've written a small user-script (AKA Greasemonkey script) to convert tg:// links into web+tg://.

Look at it:https://gist.github.com/denilsonsa/b32ee2957982bfa86a00

Install it: https://gist.github.com/denilsonsa/b32ee2957982bfa86a00/raw/telegram-tg-links-to-web-tg.user.js

Test it: http://telegramstickers.altervista.org/dr-house-sticker-pack/

@denilsonsa good job! however I'm afraid this is not suitable for most of users, they usually don't want to install something.

I'm testing the script but it doesn't seem to work with the Chrome plugin webogram.
Is that expected?

@lapo-luchini I don't know what is the plugin you are using. In fact, it is not a plugin, but probably a extension, or maybe a Chrome app. Could you provide the link to it?

Also, my script is extremely simple: look for all links in the page, if the link begins with tg://, replace it with web+tg://. Just that, nothing else.

@denilsonsa yeah, I meant the Chrome app.
And your script works perfectly, I can see the changed URL, but I guess the Chrome extension doesn't register it.

Actually, the Chrome app contains this (minified) code:

if(g=!0,"registerProtocolHandler"in navigator){
    try{navigator.registerProtocolHandler("tg","#im?tgaddr=%s","Telegram Web")}catch(t){}
    try{navigator.registerProtocolHandler("web+tg","#im?tgaddr=%s","Telegram Web")}catch(t){}
}

so I don't know why it is not working.

Is this no longer working?
I have Firefox 51.0.1 (64-bit) and https://web.telegram.org is no longer requesting to register protocol handlers.

Yeah, I've disabled it. I see no point, since only web+ is required and behaviour is different between Chrome and Fx. Also we now have fancy button on t.me pages when authorised in Telegram Web.

@zhukov , you don't see the points, so I show you. The current (and all previous) versions of desktop TG app don't support multiple accounts.

When I click the tg;// links in my mail, vk chats, fb chats and so so so on, I want to choose what account to use to send the message, because I might use web app for one account, and desktop app for another.

This is obvious and expected result.
What is the actual result?

It drops me on t.me page, where I have to close the choosing-app-window, then click "open in web".

capture

@dan-it @lapo-luchini @denilsonsa @asdofindia

navigator.registerProtocolHandler("tg",
                                  "https://web.telegram.org/#/im?tgaddr=%s",
                                  "telegram Web App");

Works perfectly. So I didn't get what the problem is.
capture

sorry for ny English
I don't understand
href="tg://resolve?domain=@kalakamalaka" don't work
href="https://t.me/kalakamalaka" work
WHY?

I have Firefox 51.0.1 (64-bit) and https://web.telegram.org is no longer requesting to register protocol handlers.

Yeah, I've disabled it. I see no point, since only web+ is required and behaviour is different between Chrome and Fx. Also we now have fancy button on t.me pages when authorised in Telegram Web.

I don't understand. I don't see any fancy buttons anywhere. When I click on telegram links I am redirected to a tg:// link which Firefox says it does not understand.

@rockfield's Javascript solved this perfectly. If it's so easy and straightforward I don't understand why it has been removed.
This has been bothering me for a long time since I have been completely unable to follow any telegram links with my computer.

I am using Telegram in Opera but I can not open new web of Telegram.
Shown a window
"Unknown Protocol : Opera was unable to open the link since no application associated with "tg:" protocol was found on your system"
May be any setting problem in Opera web ?
Please to guide me. Thanks

I have Opera version is 54.0.2952.54 & my system is 32 bit.
I am using Telegram in Opera but I can not open new web of Telegram.
Shown a window
"Unknown Protocol : Opera was unable to open the link since no application associated with "tg:" protocol was found on your system"
May be any setting problem in Opera web ?
Please to guide me. Thanks

No body want to help me or guide me. I think in this forum every one is busy.. !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

azzimuth picture azzimuth  ·  5Comments

user4302 picture user4302  ·  4Comments

thisIsTheFoxe picture thisIsTheFoxe  ·  3Comments

cbrwizard picture cbrwizard  ·  5Comments

8manuel picture 8manuel  ·  6Comments