$(document).ready(function () {
    var queryString = getUrlVars();
    var myHistory = [];
    if (!queryString) {
        var url = window.location.href.split('?')[0];
        myHistory.push(url);
        url = url.replace(/\/+$/, "");
        window.history.replaceState(myHistory, document.title, url + "/#");
    } else {
        if (reqUrlReferrer != '' && typeof reqUrlReferrer != 'undefined') {
          //  console.log('1st');
            window.location.href = urlReferrerRouteURL;
        }
    }

});

function getUrlVars()
{
    var queryStrings = [], hash;

    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    if (typeof hashes == 'undefined' || hashes == '') {
       return true;
    }
    for (var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        var query_key = hash[0];
        var query_val = hash[1];
        queryStrings[query_key] = query_val;
        if (typeof reqUrlReferrer[query_key] !== 'undefined'
                && reqUrlReferrer[query_key] !== '') {
            if (reqUrlReferrer[query_key] === query_val) {
                return false;
            }
        }
    }

    return true;
}
