2020. 9. 21. 00:45
브라우저 팝업차단 javascript로 감지 Javascript2020. 9. 21. 00:45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
var isPopupBlockerActivated = function(popupWindow) {
if (popupWindow) {
if (/chrome/.test(navigator.userAgent.toLowerCase())) {
try {
popupWindow.focus();
} catch (e) {
return true;
}
} else {
popupWindow.onload = function() {
return (popupWindow.innerHeight > 0) === false;
};
}
} else {
return true;
}
return false;
};
var popup = window.open('https://www.google.com', '_blank');
if (isPopupBlockerActivated(popup)) {
alert("팝업 차단을 해제해주세요!!");
}
|
cs |
https://stackoverflow.com/questions/2914/how-can-i-detect-if-a-browser-is-blocking-a-popup
How can I detect if a browser is blocking a popup?
Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening. What methods can the call...
stackoverflow.com
'Javascript' 카테고리의 다른 글
sumoselect 속도 문제 (0) | 2020.11.15 |
---|---|
javascript lpad function (0) | 2017.11.14 |
JQuery Cookie Plugin (0) | 2014.03.14 |
getYear() vs getFullYear() (0) | 2014.03.14 |