{"id":18888017,"url":"https://github.com/codex-team/deeplinker","last_synced_at":"2025-04-14T23:08:55.381Z","repository":{"id":57103224,"uuid":"134841700","full_name":"codex-team/deeplinker","owner":"codex-team","description":"Use one link to open installed apps or web pages","archived":false,"fork":false,"pushed_at":"2023-01-23T20:51:39.000Z","size":103,"stargazers_count":69,"open_issues_count":0,"forks_count":10,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-14T23:08:48.691Z","etag":null,"topics":["deep-link","deeplinks","electron-app","frontend","npm","protocol","scheme","telegram","yarn"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codex-team.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-25T10:30:16.000Z","updated_at":"2025-02-08T07:15:53.000Z","dependencies_parsed_at":"2023-02-13T03:15:28.538Z","dependency_job_id":null,"html_url":"https://github.com/codex-team/deeplinker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codex-team%2Fdeeplinker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codex-team%2Fdeeplinker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codex-team%2Fdeeplinker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codex-team%2Fdeeplinker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codex-team","download_url":"https://codeload.github.com/codex-team/deeplinker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975315,"owners_count":21192209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-link","deeplinks","electron-app","frontend","npm","protocol","scheme","telegram","yarn"],"created_at":"2024-11-08T07:41:21.954Z","updated_at":"2025-04-14T23:08:55.362Z","avatar_url":"https://github.com/codex-team.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deeplinker\n\nThis module helps you to create web-links for opening native applications directly if it is possible. Otherwise web page will be opened.\n\n![](./demo.jpeg)\n\n## Install\n\nYou can install script via package managers or download it to your server.\n\n### NPM and Yarn\n\nInstall package\n\n```shell\nnpm install @codexteam/deeplinker --save\n```\n\n```shell\nyarn add @codexteam/deeplinker\n```\n\nThen require `deeplinker` module\n\n```js\nconst deeplinker = require('@codexteam/deeplinker');\n```\n\n### Local script\n\nDownload [dist/deeplinker.js](dist/deeplinker.js) file to your server and add it to your webpage.\n\n```html\n\u003cscript src=\"dist/deeplinker.js\" async\u003e\u003c/script\u003e\n```\n\n## Usage\n\nLet's imagine that you want to create a link that opens some page in application, if it is installed. If target application is missing then link should open a web page as a normal link.\n\nCheck out example schemes below.\n\n### On click\n\nFirstly you need to add the following params to deeplinker elements:\n\n- `data-link` or `href` with a usual link\n- `data-app-link` with a deep link (with custom protocol) to an application\n\nSet up `data-app-link` param for links with `href`.\n\n```html\n\u003ca href=\"https://www.instagram.com/codex_team/\" data-app-link=\"instagram://user?username=codex_team\"\u003e\n  Follow us on Instagram\n\u003c/a\u003e\n```\n\nOr set up `data-link` and `data-app-link` params for any other elements\n\n```html\n\u003cdiv data-link=\"https://t.me/codex_team\" data-app-link=\"tg://resolve?domain=codex_team\"\u003e\n  Join our Telegram-channel\n\u003c/div\u003e\n```\n\nThen you need to add click listeners. There are two ways to do this.\n\n#### Add listeners automatically\n\nAdd target class name to all deeplinker elements (`deeplinker` by default). Use `deeplinker.init()` function to add listeners automatically to all elements with target class name. `event.preventDefault` and `deeplinker.click` will be added as onclick function.\n\nRun this function when page is loaded.\n\n```html\n\u003cbody onload='deeplinker.init()'\u003e\n```\n\n```html\n\u003cdiv class=\"deeplinker\" data-link=\"https://t.me/codex_team\" data-app-link=\"tg://resolve?domain=codex_team\"\u003e\n  Join our Telegram-channel\n\u003c/div\u003e\n```\n\n##### Custom selector\n\nYou can call `deeplinker.init()` with string param to set up target selector. `.deeplinker` by default.\n\nExample:\n\n```js\ndeeplinker.init('.my_deeplinker_element');\n```\n\nfor\n\n```html\n\u003cdiv class=\"my_deeplinker_element\" ...\u003e\n  Join our Telegram-channel\n\u003c/div\u003e\n```\n\n#### Set up onclick functions by yourself\n\nCall `deeplinker.click(element)` function on click.\n\nSet up click function on deeplinker elements.\n\n```html\n\u003cdiv onclick=\"deeplinker.click(this)\"\n     data-link=\"https://t.me/codex_team\"\n     data-app-link=\"tg://resolve?domain=codex_team\"\u003eJoin our Telegram-channel\u003c/div\u003e\n```\n\nFor link elements you also need to add `event.preventDefault` function:\n\n```html\n\u003ca href=\"https://www.instagram.com/codex_team/\"\n   onclick=\"event.preventDefault(); deeplinker.click(this)\"\n   data-app-link=\"instagram://user?username=codex_team\"\u003eFollow us on Instagram\u003c/a\u003e\n```\n\n\n### Try to open app automatically\n\nIf you want to try to open app silently then call `deeplinker.tryToOpenApp(deepLink)`.\n\nCould be useful for redirection or invitation pages.\n\n\u003e Doesn't work on mobile devices.\n\n```html\n\u003cbody onload=\"deeplinker.tryToOpenApp('tg://user?username=codex_team')\"\u003e\n```\n\n## Schemes of popular apps\n\n### Telegram\n\n```\ntg://resolve?domain=[username]\n```\n\n### Twitter\n\n```\ntwitter://user?screen_name=[username]\n```\n\n### Instagram\n\n```\ninstagram://user?username=[username]\n```\n\n### Facebook\n\n```\nfb://profile/[id]\n```\n\n### VK\n\n```\nvk://vk.com/[id]\n```\n\n## Issues and improvements\n\nFeel free to ask a question or improve this project.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodex-team%2Fdeeplinker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodex-team%2Fdeeplinker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodex-team%2Fdeeplinker/lists"}