Javascript에서 팝업창을 띄우기 위해 window.open()함수를 이용한다.
function pop() {
var settings = 'toolbar=0, status=0, menubar=0, scrollbars=yes, height=600, width=800';
var target = 'popup.html';
window.open(target, 'popup_name', settings);
}
하지만, sapari에서 팝업창이 작동안하는 경우가 있다. 또한, sapari로 작동되는 iPad에서도 역시 작동이 안된다.
window.open()함수를 직접적으로 띄울 때는 작동이 되나,
Ajax를 이용해 callback했을 때 새 창을 띄운다든지, 간접적으로 함수호출하여 window.open()을 이용하게 되면 작동을 안한다.
Ajax를 사용할 때도 모든 Browser에서 작동하게 하려면 다음과 같이 작성한다.
var popup;
function pop() {
var settings = 'toolbar=0, status=0, menubar=0, scrollbars=yes, height=600, width=800';
var target = 'popup.html';
popup = window.open('about:blank', 'popup_name', settings);
$.load("url", function() {
popup.location = target;
});
}
'Technology > Programming' 카테고리의 다른 글
| Python / MBR MeSH 파싱하기 (0) | 2012.01.17 |
|---|---|
| PHP / 올바른 코딩, 잘못된 코딩 (0) | 2011.12.15 |
| jQuery / 이벤트, 셀렉터, DOM 관련 함수, AJAX 정리 (0) | 2011.11.30 |
| PHP / 날짜 다루기 (0) | 2011.11.26 |
| jQuery / createElement (0) | 2011.11.17 |