0

I want to open new HTML page in the same tab. I tried using window.open('home.html','_self');, but this does not work. However, if I use window.open('home.html');, it opens in a new window.

How can I open HTML in the same page? I have tried all of these but none of them worked:

//window.open("home.html", '_top');
//window.location.replace("home.html");
//window.open('home.html','_self');
//window.location.assign("home.html")
Pika Supports Ukraine
  • 3,612
  • 10
  • 26
  • 42
  • 2
    Possible duplicate of [How do I redirect to another webpage?](https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage) – dustytrash Apr 05 '19 at 14:59

2 Answers2

0

Try using the window.location.href function.

E.g. window.location.href = "home.html";

markmarkmark
  • 164
  • 1
  • 9
0

I'm not sure you want to use this in HTML or JQuery...whatever:

HTML

<a href="home.html">Home</a>

Jquery

location.href = "home.html";
alesssz
  • 384
  • 4
  • 18