BOM Browser Object Model Location Object tutorial in JavaScript

 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>BOM Location Object JavaScript</title>
</head>

<body>
    <h1>JavaScript: Location Object</h1>
    <button onclick="newFunction()">Click</button>
    <button onclick="newFunctionTwo()">Reload</button>
    <button onclick="newFunctionThree()">Assign</button>
    <button onclick="newFunctionFour()">Replace</button>
    <script>
        // The Window Location Object
        // The location object contains information about the current URL.

        // The location object is a property of the window object.

        // The location object is accessed with:

        // window.location or just location
        function newFunction() {
            location.href = "http://youtube.com";
        }
        function newFunctionTwo() {
            location.reload();
        }
        function newFunctionThree() {
            location.assign("https://www.google.com");
        }
        function newFunctionFour() {
            location.replace("https://www.google.com");
        }
    </script>
</body>

</html>


Comments

Popular posts from this blog

Symbols tutorial in Advance JavaScript

Async and Await Method tutorial in Advance JavaScript

String Methods in JavaScript