Giter Club home page Giter Club logo

appurl's Introduction

AppURL

redirect users from your website to your app

Except for some minor revisions, this is the original documentation from appURL.org before they stopped supporting appurl.js and took the library and documentation offline.

Even if you AppURL-enable your app, users who have your app installed might still end up on your website:

You can redirect users from your website to your app (if installed on their device) using our JavaScript library at https://raw.githubusercontent.com/barsh/AppURL/master/appurl.js.

Under the <head> tag in your HTML, add the following to import the AppURL.openUrl function.

To automatically call this function on page load, add it to an onload event handler:

if (window.addEventListener) {
    window.addEventListener('load', function() {
        AppURL.openUrl();
    });
} else { // For IE support
    window.attachEvent('onload', function() {
        AppURL.openUrl();
    });
}

Or if you use jQuery:

$(document).ready(function() {
    AppURL.openUrl();
});

Any of the following would open the Grid6 app from http://grid6.us/bbbbbbaa:

/*
    1. Make an API call to AppURL.org
    2. Compute transformation for this URL
    3. Perform the redirect
*/
AppURL.openUrl('http://grid6.us/bbbbbbaa')
/*
Calling without arguments uses location.href

    If you are on http://grid6.us/bbbbbbaa
    this is equivalent to:
        AppURL.openUrl('http://grid6.us/bbbbbbaa')
*/
AppURL.openUrl();
/*
    If you already know the native URL,
    simply provide it as a second argument
*/
AppURL.openUrl(
    'http://grid6.us/bbbbbbaa',
    'grid6.us:/bbbbbbaa')

Library Reference

Implements an AppURL client at the JavaScript level.

Takes two optional arguments:

  • webUrl - The URL to open. Defaults to the current page's URL.
  • nativeUrl - The custom-scheme URL to attempt to open in an app. If this argument is omitted, the library makes a call to the AppURL.org API's /transform method and uses the nativeUrl field in the API response.

If AppURL.openUrl() doesn't successfully launch an app on your user's device, it fails silently and doesn't needlessly refresh your page. If you have an AppURL-enabled app, we recommend making an AppURL.openUrl() call at load time everywhere on your website.

appurl's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.