POP DETECTOR
Buen dÃa, javascript me atropella con este script:
Como puedo detectar si un usuario tiene activado el bloqueo para pop-ups(ventanas emergentes), esto con el ánimo de informarle y presentarle una ayuda para que deje abrir la ventana emergente (window.open)
Gracias
Como puedo detectar si un usuario tiene activado el bloqueo para pop-ups(ventanas emergentes), esto con el ánimo de informarle y presentarle una ayuda para que deje abrir la ventana emergente (window.open)
Gracias
Te va un script que hace exactamente lo qu enecesitas, lo he usado en IE, FireFox, Opera y Safari
function isPopupBlockerDetected(){
var isPopupBlocked = true;
var testWindow1 = window.open("","test","width=0,height=0,left=2000,top=2000");
var testWindow2 = window.open("","test","width=0,height=0");
if(testWindow1==testWindow2){
isPopupBlocked = false;
}
if(testWindow1!=null){
testWindow1.blur();
testWindow1.close();
}else{
isPopupBlocked = true;
}
return isPopupBlocked;
}
Salu2
function isPopupBlockerDetected(){
var isPopupBlocked = true;
var testWindow1 = window.open("","test","width=0,height=0,left=2000,top=2000");
var testWindow2 = window.open("","test","width=0,height=0");
if(testWindow1==testWindow2){
isPopupBlocked = false;
}
if(testWindow1!=null){
testWindow1.blur();
testWindow1.close();
}else{
isPopupBlocked = true;
}
return isPopupBlocked;
}
Salu2