The following works in Chrome but not in Edge/IE. document.activeElement.href always returns "undefined" for Edge/IE. Is there a way to determine if destination URL is for my site or a external site?
window.addEventListener("beforeunload", function (e) {
        if (document.activeElement.href == undefined) {
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: "/Profile/DestroySession",
                dataType: "json",
                async: true,
                success: function (data) {
                    alert(data.d);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    console.log(textStatus);
                    console.log(errorThrown);
                    debugger;
                }
            });
        }
    });