Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codexteam/deeplinker

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codexteam/deeplinker

Tiny script that helps you to use one link to open web pages or installed apps

  • 1.0.6
  • npm
  • Socket score

Version published
Weekly downloads
19
decreased by-29.63%
Maintainers
4
Weekly downloads
 
Created
Source

Deeplinker

This module helps you to create links to open pages in apps directly if it is possible. Otherwise web page will be opened.

Install

You can install script via package managers or download it to your server.

NPM and Yarn

Install package

npm install @codexteam/deeplinker --save 
yarn add @codexteam/deeplinker

Then require deeplinker module

const deeplinker = require('@codexteam/deeplinker');

Local script

Download dist/deeplinker.js file to your server and add it to your webpage.

<script src="dist/deeplinker.js" async></script>

Usage

Let'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.

Check out example schemes below.

On click

Call deeplinker.click(element) function. Element should contain the following params:

  • data-link or href with a usual link
  • data-app-link with a deep link (with custom protocol) to an application

Upgrade your link element by adding a listener with preventing default action. Set up data-app-link param.

<a href="https://www.instagram.com/codex_team/"
   onclick="event.preventDefault(); deeplinker.click(this)"
   data-app-link="instagram://user?username=codex_team">Follow us on Instagram</a>

Or add listener to any element. Set up data-link and data-app-link params.

<div onclick="deeplinker.click(this)"
     data-link="https://t.me/codex_team"
     data-app-link="tg://resolve?domain=codex_team">Join our Telegram-channel</div>

Run automatically

If you want to try to open app silently then call deeplinker.tryToOpenApp(deepLink).

Could be useful for redirection or invitation pages.

Doesn't works on mobile devices.

<body onload="deeplinker.tryToOpenApp('tg://user?username=codex_team')">

Telegram

tg://resolve?domain=[username]

Twitter

twitter://user?screen_name=[username]

Instagram

instagram://user?username=[username]

Facebook

fb://profile/[id]

VK

vk://vk.com/[id]

Issues and improvements

Feel free to ask a question or improve this project.

License

MIT

Keywords

FAQs

Package last updated on 27 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc