I would like to know if it's possible to handle all the links like
`tg://resolve?domain=telegram` in my application. I tried adding code like
this:
"view": {
"href": "/index.html",
"disposition": "window",
"filters": {
"type": "url",
"url": {
"required": true,
"pattern": "tg:.{1,16384}",
"regexp": "^tg:"
}
},
"returnValue": false
},
to the activities list in my manifest.webapp but it doesn't seem to work.
I've faced this problem while implementing Telegram app. Every user, who
chooses username, has personal link, like https://telegram.me/username
(e.g. https://telegram.me/telegram). This web page has redirect to the
page with `tg:` protocol, which the app should handle.
The app is hosted on GitHub: https://github.com/zhukov/webogram
Here is current manifest:
https://github.com/zhukov/webogram/blob/master/app/manifest.webapp
And here is the link to the code of activity handler:
https://github.com/zhukov/webogram/blob/master/app/js/services.js#L3969
In order to reproduce the problem I install the most recent version of app
on device with FxOS 2.5 and open link telegram.me/telegram in the default
browser.
Expected behaviour: it should open Telegram app and log 'Received activity'
in the console.
Current behaviour: the page shows error and browser windows closes. I see
errors like thise in adb logcat:
E/Browser (10384): Content JS ERROR: net-error
E/Browser (10384): at initPage
(about:neterror?e=unknownProtocolFound&u=tg%3A//resolve%3Fdomain%3Dtelegram&c=&f=browser&m=app%3A//
system.gaiamobile.org/manifest.webapp&d=Firefox%20doesn%27t%20know%20how%20to%20open%20this%20address%2C%20because%20one%20of%20the%20following%20protocols%20%28tg%29%20isn%27t%20associated%20with%20any%20program%20or%20is%20not%20allowed%20in%20this%20context.:1358:7002
)
E/Browser (10384): at ee_emit
(about:neterror?e=unknownProtocolFound&u=tg%3A//resolve%3Fdomain%3Dtelegram&c=&f=browser&m=app%3A//
system.gaiamobile.org/manifest.webapp&d=Firefox%20doesn%27t%20know%20how%20to%20open%20this%20address%2C%20because%20one%20of%20the%20following%20protocols%20%28tg%29%20isn%27t%20associated%20with%20any%20program%20or%20is%20not%20allowed%20in%20this%20context.:1093:89
)
E/Browser (10384): at setReady
(about:neterror?e=unknownProtocolFound&u=tg%3A//resolve%3Fdomain%3Dtelegram&c=&f=browser&m=app%3A//
system.gaiamobile.org/manifest.webapp&d=Firefox%20doesn%27t%20know%20how%20to%20open%20this%20address%2C%2
I also tried removing and modifying 'pattern' / 'regexp' parameters, tried
handling `https://telegram.me/*` prefix instead of `tg:`. It didn't help.
Please help me to solve the problem.
_______________________________________________
dev-fxos mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-fxos