Procedure links to government sites

Some of the requirements of government Web sites or sites of municipal authority, that if there is an external link, the client will notice that explains to him that the site is directed not belong to the same authority.



Here is a Jquery code that can help you


$(document).ready(function () {

    $("a").click(function(event) {

        // check if the target link is yoursite.gov

        // if not will show alert message

        if (this.href.indexOf("yoursite.gov") == -1) {

            if (this.href.startsWith("http")) {

                event.preventDefault();

                var linkLocation = this.href;

                alert('Please note that you are directed to an external site does not belong to this government ');

                window.open(linkLocation, '');

                return false;

            }

        }

    });

});


Thank you,
Roi

Comments

Popular posts from this blog

A sharepoint list view of the current month

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters

Export SharePoint 2010 List to Excel with PowerShell