Home > Blockchain >  how to redirect to a page in Javascript or Jquery with CSS
how to redirect to a page in Javascript or Jquery with CSS

Time:06-25

I tryied multiple piece of code to redirect to another HTML page in my .js file :

windows.location.href("../index.html")

(for example)

The page load but not the CSS wont load. Can someone help me ?

CodePudding user response:

You can use this if you want the redirect to happen in a new tab. and this to open in the same tab window.open("https://stackoverflow.com/users/13082963/purke-gopinand?tab=profile", "_self");

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
  window.open("https://stackoverflow.com/users/13082963/purke-gopinand?tab=profile");
}

CodePudding user response:

function redirect_Page () {
        var tID = setTimeout(function () {
            window.location.href = "https://www.google.de/";
            window.clearTimeout(tID);
        }, 5000);
    }

or

    setTimeout(function () {
    window.open('https://www.google.de/', '_blank');
}, 5000);
  • Related