function failFeatureTest(title, message)
{
    document.getElementById("modaltitle").innerText = title || "Outdated Browser";
    document.getElementById("modalmessage").innerText = message || "AMP cannot run on this system because your browser is too outdated, and doesn't support features used by modern web applications.";
    document.getElementById("modalsubtitle").innerText = "Please use a newer browser to use AMP.";
    document.getElementById("mainModal").style.backgroundColor = "black";
    document.getElementById("mainModal").style.display = "block";
    document.getElementById("relatedLinkA").innerText = "Browser-Update.org";
    document.getElementById("relatedLinkA").href = "https://browser-update.org/update.html";
    document.getElementsByClassName("modalpanel")[0].classList.add("visible");
    document.getElementById("modalAdvanced").style["display"] = "none";
    throw new Error("Outdated Browser");
}

if (document.addEventListener === undefined)
{
    failFeatureTest();
}

const isIE11 = !!window.MSInputMethodContext && !!document.documentMode;

if (isIE11)
{
    failFeatureTest("Unsupported Browser", "AMP cannot run on Internet Explorer 11 as it does not support asynchronous javascript operations. Please either use Edge (Windows 8.1/Server 2012 R2+ Users) or another supported browser such as Firefox or Chrome.");
}