현재 윈도우를 닫은 다음 런타임에 새 윈도우를 다시 열어야하는 dotnet 어플리케이션이 있습니다. 나는 그것을 위해 자바 스크립트를 사용했다. 코드는 다음과 같습니다 :window.open()이 IE6 및 IE7에서 작동하지 않습니다.
function OpenNewWindow() {
if (ConfirmStartTest()) {
closeWindow();
window.open("OnlineTestFrame.aspx", "_Parent", "model=yes,dailog=no,top=0,height=screen.height,width=screen.width,status=no,toolbar=no,menubar=no,location=no,zoominherit =0,resizable =no,scrollbars=yes,dependent=no,directories=no,taskbar=no,fullscreen=yes");
self.focus();
}
}
//taking the confirmation for starting test
function ConfirmStartTest() {
var result = confirm("Do you want to start the test now?");
return result;
}
//function to close the current window
function closeWindow() {
//var browserName = navigator.appName;
//var browserVer = parseInt(navigator.appVersion);
var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
if (ie7)
{
//This method is required to close a window without any prompt for IE7
window.open('','_parent','');
window.close();
}
else
{
//This method is required to close a window without any prompt for IE6
this.focus();
self.opener = this;
self.close();
}
}
이제이 응용 프로그램을 IE7과 IE6에서 실행할 때 실행되지 않습니다. 그러나 IE8에서는 잘 돌아갑니다.
이 코드는 이전의 모든 IE6 n IE7에서 정상적으로 작동했습니다. 갑자기 오류가 발생합니다. 새 창을 열 수 없으며 갑자기 b/w에서 멈출 수 없습니다.
아무쪼록이 문제와 관련하여 궁금한 점이 있으면 알려 주시기 바랍니다.
갑자기 작동이 멈췄다 고하는데, 그 전에 어떤 변경을 했습니까? –
또한 "self"변수의 초기화가 보이지 않습니까? 아니면 누락 되었습니까? 아니면 스 니펫 외부에 있습니까? –
@Niklas - https://developer.mozilla.org/en/window.self – epascarello