Home > Net >  Redirecting without clicking
Redirecting without clicking

Time:10-29

How can i make redirect without clicking.

i want to do it automatically

<script>
    $("#Div3").click(function(){

    window.location.replace("http://your.next.page/");

});

</script>

CodePudding user response:

If you want to redirect as soon as the page is loaded, you can use

$( document ).ready(function() {
    window.location.replace("http://your.next.page/");
});

or you can use window.location.href to simulate a mouse click, whereas .replace simulates a HTTP redirect from the server, if that matters to you.

CodePudding user response:

you can add in the header :

<head>
  <meta http-equiv = "refresh" content = "3; url = http://your.next.page/" />
</head>

source

CodePudding user response:

You can use window.location.replace("http://your.next.page/"); directly so that the page is reloaded as soon as the javascript code is read.

  • Related