Reference Guide
Reference Guides / JavaScript API / Events / RegisterOnUriNavigation
In This Topic
    RegisterOnUriNavigation
    In This Topic
     RegisterOnUriNavigation

    This function allows you to trigger a function of your own before an URI is reached.

    RegisterOnUriNavigation: function (docuViewareID, callback)

    Example of usage

    This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load.

    function RegisterOnUriNavigationOnAPIReady() {
        if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
            DocuViewareAPI.RegisterOnUriNavigation("DocuVieware1",
                function(param)  {
                //Uncomment line below to block navigation to {param.uri} URI
                //param.cancel = true;
                console.log(param);
            });
            }
        else {
            setTimeout(function () { RegisterOnUriNavigationOnAPIReady() }, 10);
        }
    }
    document.addEventListener("DOMContentLoaded", function () {
        RegisterOnUriNavigationOnAPIReady();
    }, false);

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance.
    callback
    The function you want to execute on event.
    The callback provides an argument having a prototype { uri, cancel }.
    - uri specifies the uri that will be reached.
    - cancel is a boolean specifying whether the operation must be aborted (the receiver must set it to true for such purpose).

    Return Value

    0 if success. 1 if error.