Add line below to head tag of html:
    <script src="ClientGlobalContext.js.aspx" type="text/javascript"></script>
Also add this code for running in case of loading of html:
 <script src="OnLoadHtml.js" type="text/javascript"></script>
in javascript OnLoadHtml.js add these codes below:
document.onreadystatechange = function () {
    //When document is ready
    if (document.readyState == "complete") {
        //Get sent arguments in url
        var arguments = GetQueryArgument();
        //Decode encoded arguments
        var decodedArguments = decodeURIComponent(arguments)
    }
}
//Gets query passed argument
function GetQueryArgument()
{
    /*Get the any query string parameters and load them
    into the vals array*/
    var result = "";
    var vals = new Array();
    if (location.search != "") {
        vals = location.search.substr(1).split("&");
        for (var i in vals) {
            vals[i] = vals[i].replace(/\+/g, " ").split("=");
        }
        //look for the parameter named 'data'
        var found = false;
        for (var i in vals) {
            if (vals[i][0].toLowerCase() == "data") {
                result = vals[i][1];
                found = true;
                break;
            }
        }
        if (!found)
        {
            result = "";
        }
    }
    else
    {
        result = "";
    }
    return result;
}
To return result from html to javascript back:
Add line below to body tag of html:
    <input id="btnOk" type="button" class="NormalButton" value="OK" onclick="BtnOK_OnClick();">
And add this code below for javascript part:
//On ok button pressed
function BtnOK_OnClick() {
    debugger;
    console.log("Ok is clicked");
    var result = GetResult();
    //Control value is not empty
    if (result === "")
    {
        retrun;
    }
    Mscrm.Utilities.setReturnValue(result);
    try
    {
        closeWindow(true); // Close the dialog box
    }
    catch (e)
    {
        console.log("Error happened at closing.");
    }
}