
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
deeplink-handler
Advanced tools
Easily create an endpoint in your web server that redirects deep links to mobile apps
Easily create express endpoint to handle mobile deeplinks in your web server
Takes away the pain of forwarding users to the right app store / mobile app depending on their platform.
This is a fork of node-deeplink ( https://github.com/mderazon/node-deeplink ). The original module has security issue due to its dependency on html-inline
, which is no longer maintained.
This module depends on inline-source
instead. For the rest, its API has remained the same and can be used as drop in replacement for node-deeplink
.
In ios >= 9, Apple has made it impossible to provide a smooth user experience to redirect user to app / fallback to app store from javascript. Their clear direction is pushing towards using Universal Links instead.
For more details, see issue #9 and this blog post.
To get the best user experience, it's probably better to look at Universal Links for ios and App Links for Android.
If you already started using Universal Links, you can still use this module as a fallback mechanism for older ios versions.
Suppose you have a custom url scheme app://
handled by your mobile apps. You want to create a universal "smart" link that will know where to send the user:
var express = require('express');
var deeplink = require('node-deeplink');
var app = express();
app.get(
'/deeplink',
deeplink({
fallback: 'https://cupsapp.com',
android_package_name: 'com.citylifeapps.cups',
ios_store_link:
'https://itunes.apple.com/us/app/cups-unlimited-coffee/id556462755?mt=8&uo=4',
})
);
This example creates an endpoint GET /deeplink
in your web server.
Assuming your server address is https://acme.org
, you can use the link https://acme.org/deeplink?url=app://account
so when users will open it the app will open with app://account
deeplink or the users will be redirected to download the app in case they don't have it.
Note on url encoding: to avoid problems with url parsing libraries, the deep link (app://...
part) has to be url encoded. node-deeplink will decode the url correctly. So, in the above example, the link is actually https://acme.org/deeplink?url=app%3A%2F%2Faccount
. Here's an example of url encoder/decoder.
node-deeplink currently only supports Android and ios.
Options to pass on to node-deeplink are:
url
: mandatory. The deeplink url you want the user to be directed to e.g. app://account
.fallback
: mandatory. A fallback url in case the user is opening the link via an unsupported platform like desktop / windows phone etc. In such case, the fallback url will be opened in the user's browser like a normal link.android_package_name
: optional. In case you want to support Android deep links, pass your app's package name.ios_store_link
: optional. In case you want to support ios deep links, pass your app's itunes url. You can get it here.title
: optional. Title for the intermediate html page. Defaults to an empty string.When a request comes in, the following query params are checked:
url
: optional. If available, will prefer this deeplink url over the one from the options.fallback
: optional. If available, will prefer this fallback address over the one from the options.node-deeplink works by first sending the user to an html page with a user-agent sniffing script. After figuring out the user's device, it redirects them to the predefined deeplink. In practice, after clicking the link, the browser will be opened for a very short moment and then the redirect will happen.
FAQs
Easily create an endpoint in your web server that redirects deep links to mobile apps
We found that deeplink-handler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.