07 December 2012

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")) {


                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,

No comments:

Post a Comment