2017-11-29 1 views
0

window.open("file")을 사용하면 파일이 새 탭으로 열립니다. 이미 .load을 시도했지만 작동하지 않습니다. html 파일이 실행중인 윈도우에서 직접로드되는 문제를 해결하는 방법을 알고있을 것입니다.javascript 조건 다음에 파일 로딩

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(); 
+2

가능한 중복 https://stackoverflow.com/questions/8454510/open-를 참조 window.location.assign("welcome.html"); 대신 window.open("welcome.html");

로 사용할 수 있습니다 url-in-same-window-and-same-tab) – Durga

답변

1

당신은 현재 탭에서 파일을 열 수 있지만 name 매개 변수에 _self 인수를 추가하는 것은 :

window.open("welcome.html","_self"); 
           ▲ 

당신은 또한 window.location.href를 사용하여 동일한을 얻을 수 있습니다

window.location.href = "welcome.html"; 
0

사용할 수 있습니다

window.location.href = "welcome.html"; 

동일한 탭에 파일이 열립니다.

0

당신은 [같은 창에서와 같은 탭에서 열기 URL] (이 article