Login

Learning & Support

Documentation

Custom URL Schemes for Twixl publications

Twixl Support Team Updated: - Created :

    A number of custom URL schemes can be used in a web hyperlink, a web viewer, a web overlay, the kiosk info page, the kiosk info cell, in the entitlements dialog and the embedded web browser.

    NOTE ABOUT THE EXAMPLES:

    Don't include the square brackets [], they are only there for demonstration purposes.

    1. Article and page links

    (Available in a hyperlink, a web viewer or a web overlay)

    If you want to add a link to a page in your publication from within a web viewer or web overlay window, you can do so by creating an HREF like the one below:

    tp-pagelink://{article_name}/{page_number}

    An example would be:

    <a href="tp-pagelink://TOC/3">

    TIP:

    The article-name needs to be the name of the InDesign-file. So, in case of the example, the name of the InDesign-file is TOC.indd

    TIP:

    We support navto:// urls as well, so you don't need to convert these. Also see this KB-article.

    A number of URL schemes for relative article and page navigation are available:

    tp-next-article://show
    Go to the next article.
    tp-previous-article://show
    Go to the previous article.
    tp-first-article://show
    Go to the first article of the publication.
    tp-last-article://show
    Go to the last article of the publication.
    tp-next-page://show
    Go to the next page (if at the last page of an article, go to the next page in the following article).
    tp-previous-page://show
    Go to the previous page (if at the first page of an article, go to the last page of the previous article).
    tp-first-page://show
    Go to the first page of an article.
    tp-last-page://show
    Go to the last page of an article.
    tp-article-top://show
    Go to the top of a long-page article.
    tp-article-bottom://show
    Go to the end of a long-page article.

    2. Show/hide toolbar

    (Available in a web viewer and web link)

    tp-toolbar://hide
    Hides the toolbar with the Table of Contents icon, and optional sharing and bookmarking icons.
    tp-toolbar://show
    Displays the toolbar with the Table of Contents icon, and optional sharing and bookmarking icons.
    tp-toolbar://toggle
    Toggles the current view, whether visible or invisible.

    3. Show Table of Contents

    tp-toc://show

    When the tp-toc://show url is triggered, it will show the Table of Contents dropdown. Available in a Hyperlink, a Web viewer or a Web Overlay Button.

    5. Phone call

    callto:[number]

    Allows you to trigger a phone call. Note that this will work on phones only.

    Example:

    callto:+32493252577

    6. Close the current window

    tp-close://self

    Closes the current window. Available in a Web Overlay Button, an embedded web browser (i.e. the one triggered by tapping a hyperlink), the kiosk infoPage.html and the Entitlements dialog.

    7. Launching an app

    It is possible to trigger launching an app from within a Twixl publication using the following scheme:

    Please note that the implementation is slightly different on iOS vs Android.

    • iOS: the URL scheme is the same as the application identifier:

    e.g. if the app identifier is com.twixlmedia.myapp -> then the URL to launch the app would be: com.twixlmedia.myapp://

    • Android: the URL scheme is the same as the app identifier without the dots, dashes, underscores and all lowercase:

    e.g. if the app identifier is com.twixlmedia.myapp-> the the URL to launch the app would be: comtwixlmediamyapp://

    IMPORTANT NOTE:

    This will only work if the app has already been installed on the device.

    8. Launching third-party apps

    In this scenario, it depends on the url schemes supported by the app you want to launch. E.g. an app which can be opened using the url scheme com.mycustomapp:// can be launched by simply creating a hyperlink as follows:

    <a href="com.mycustomapp://">Launch My Custom App</a>

    This is now supported anywhere in an article-based / issue-based / single-issue app where you can enter an URL.

    IMPORTANT NOTE:

    This will only work if the app has already been installed on the device.

    9. Opening a hyperlink in the device browser

    tp-open-in-device-browser=1

    Although in most cases, you want to keep readers in the embedded browser, sometimes you may want to open a link directly in Safari on iPad or in the default browser on Android. A good use case for this is if you want to link to a PDF that you want readers to be able to download.

    You can do this by adding this extra parameter to your URL. Available for Hyperlinks.

    Some examples:

    The URLs below will open in the embedded app browser:

    http://www.website.com/file.pdf?id=1
    http://www.website.com/file2.pdf

    And these will open in the device browser:

    http://www.website.com/file.pdf?id=1&tp-open-in-device-browser=1
    http://www.website.com/file2.pdf?tp-open-in-device-browser=1

    10. Open in embedded web browser

    tp-open-in-web-browser=1

    Adding this url parameter to a hyperlink in an infoCell will open the link in the embedded web browser instead of opening within the infoCell itself.

    11. Get the device info via JavaScript

    Adding the following JavaScript code to your Content Item, Web Viewer, Web Overlay Button, ...

    window.location.href = "tp-device-info://";

    will execute the following JavaScript function:

    function twixlOnGetDeviceInfo(deviceUDID, appVersion, appIdentifier, entitlementToken) {
    }

    This then gives you access to the Device UDID, the app version, the app identifier and the entitlement token. You can also customize the name of the function that gets called:

    window.location.href = "tp-device-info://myCustomFunctionName";
    function myCustomFunctionName(deviceUDID, appVersion, appIdentifier, entitlementToken) {
    }

    SAMPLE FILES:

    For more info, see the sample files on this GitHub-page.

    Was this article helpful?

    0 out of 0 found this helpful