Ads Here

Thursday 23 July 2020

Redirecting th page in javascript

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>      
        
        <input type="button" value="redirect" id="btn" onclick="myFun()">
<input type="button" value="redirect1" id="btn" onclick="myFun1()">

        <script>
                document.write(window.location.href);
document.write("<br>");
document.write(window.location.Hostname);
document.write("<br>");

function myFun(){
window.location = ('https://www.youtube.com/watch?v=ecWxI0_UfAA&t=330s');

}
function myFun1(){
window.location.assign('https://www.youtube.com/watch?v=ecWxI0_UfAA&t=330s');

}
        </script>
</body>
</html>

Other: window.location.protocol
            window.location.pathname
            window.location.host



            

No comments:

Post a Comment