Front-End/javascript
[javascript] 팝업 차단 피하기(강제로 띄우기)
철갑
2021. 11. 2. 09:09
728x90
1. 비동기 처리를 하기 전에 새창을 띄운다
2. 비동기 작업이 끝난 후 url을 설정해준다
function Pop(){
// 비동기 call 전 팝업창을 띄워줌
var Popup = window.open(url, windowName, [windowFeatures]);
$.ajax({
url:"url",
success:function(response){
// 비동기 작업이 끝난 후 url 설정
if(Popup) {
Popup.location.href=response;
}
}
);
}
참고 : https://stackoverflow.com/questions/20696041/window-openurl-blank-not-working-on-imac-safari
728x90