Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
JS avoid popup blocker

I have an pop-under. It opens a duplicate of current page and redirects old page to google.com. Also it is working once a day (with cookies). But every time it is blocking with popup blocker. I heard that I can avoid it with execution function on user interact so I added onscroll function:

document.addEventListener('scroll', function() {
function setCookie(cname,cvalue,exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    var expires = "expires=" + d.toGMTString();
    document.cookie = cname+"="+cvalue+"; "+expires;
}

function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1);
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}

function showOnceInADay() {
    var user=getCookie("username1");
    if (user != "") {
    } else {
        window.open(window.location.href);window.location.href='https://www.google.com/';
           setCookie("username1", 1, 1);
    }
}


jQuery(document).ready(function($) {
        showOnceInADay() ;
});
})

How can I avoid it in another way? I've read answers to this question Avoid browser popup blockers but Can I do this without onclick event? Pop-under should be opened in first user interactive with a page

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda