Reputation: 3
When I use window.open("file")
then it'll open the file as a new tab. I already tried .load
but it doesn't work either. You may know how to solve my problem that the html file loads directly in the running window ?
function progress() {
var prg = document.getElementById('progress');
var percent = document.getElementById('percentCount');
var counter = 5;
var progress = 25;
var id = setInterval(frame, 64);
function frame() {
if (counter == 100) {
clearInterval(id);
window.open("welcome.html")
}
else {
progress += 5;
counter += 1;
prg.style.width = progress + 'px';
percent.innerHTML = counter + '%';
}
}
}
progress();
Upvotes: 0
Views: 58
Reputation: 16675
You can open the file in the current tab but adding the _self
argument to the name
parameter:
window.open("welcome.html","_self");
▲
You can also achieve the same by using window.location.href
:
window.location.href = "welcome.html";
Upvotes: 1
Reputation: 2571
You can use window.location.assign("welcome.html");
instead of window.open("welcome.html");
See this article
Upvotes: 0
Reputation: 1511
you can use
window.location.href = "welcome.html";
It will open file in same tab.
Upvotes: 1