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

    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")) {
                function(param)  {
                //Uncomment line below to block navigation to {param.uri} URI
                //param.cancel = true;
        else {
            setTimeout(function () { RegisterOnUriNavigationOnAPIReady() }, 10);
    document.addEventListener("DOMContentLoaded", function () {
    }, false);


    The identifier for the DocuVieware™ instance.
    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.