Free Puzzle Questions with Answer using Java, C#, JavaScript and PHP

JavaScript - Page Redirection

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script language="JavaScript" type="text/javascript">
        function AutomaticPageRefresh(){
            setTimeout("location.reload(true)", 3000); //3000 = 3 second
        }

        function RedirectToMySite(){
            window.location = "http://www.freesampleprojects.com";
        }

        function ManageTimingForRedirection(){
            setTimeout('RedirectToBrowserBasedPage()', 3000);
        }

        function RedirectToBrowserBasedPage(){
            var browserName = navigator.userAgent;
            var edge = browserName.lastIndexOf("Edge");
            var chrome = browserName.lastIndexOf("Chrome");

            if(edge != -1){
                //using edge browser
                window.location = "http://www.freesampleprojects.com";
            }
            else if(chrome != -1){
                //using chrome
                window.location = "http://www.amazingitnews.com";
            }
        }
    </script>
</head>
<body>
    <button onclick="javascript:location.reload(true)">Refresh Page</button>
    <button onclick="AutomaticPageRefresh()">Autom Refresh after 3 Seconds</button>
    <button onclick="RedirectToMySite()">Redirect Manual</button>

    <br/>
    <br/>
    The page will be redirected in 3 seconds after you click the button below <br/>
    <br/>
    <button onclick="ManageTimingForRedirection()">Redirect To Browser Pages</button>
</body>
</html>