을 사용하여 작은 팝업 참조 창을 열고 window.open(...)
이름을 지정합니다. window.open
해당 창에 대해 후속 이 호출 될 때 적절하게 재사용됩니다 .
function openHelp(hash) {
var helpWindow = window.open(location.protocol + "/help.aspx" + (hash ? "#" + hash : ""), "helpWindow", "width=750, height=600, resizable=1, scrollbars=1, location=0, directories=0, status=no, menubar=no, toolbar=no");
}
제대로 작동하지 않는 한 가지 경우는 누군가가 도움말 페이지 URL에서 창을 열고 해시 만 변경하는 경우입니다 (예 :) #jump-to-me
. 페이지를 다시로드 할 때만 페이지가 해시로 올바르게 이동합니다.
열린 창을 찾고 URL이 열려고하는 것과 일치하는지 확인 window.location.refresh()
하고 해시가 변경 될 때 조건부로 수행하는 방법 이 있습니까?
이벤트에 대한 특정 창에 이벤트 리스너를 추가하기 만하면 hashchange
됩니다.
function openHelp(hash) {
var helpWindow = window.open(location.protocol + "/help.aspx" + (hash ? "#" + hash : ""), "helpWindow", "width=750, height=600, resizable=1, scrollbars=1, location=0, directories=0, status=no, menubar=no, toolbar=no");
helpWindow.addEventListener("hashchange", function () { this.location.reload() }, false);
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다