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

493
Vistas
webRequest is not working with https://www.youtube.com/?

I have an array of URLs in local storage, and I am trying to block those. All URLs except https://www.youtube.com/ are blocked successfully. Even when refreshing the page in case of https://www.youtube.com/, it is logging to the console "entered" that is inside the if statement of blockListener. then even after this is not blocking the request.

Why is happening so?

code is here.......


    function blockListener(details) {  
            var sites = JSON.parse(localStorage.getItem(sitesToBeBlockedKey));//got sites array
            console.log(sites.includes(details.url));
            if(sites.includes(details.url)){
                console.log('entered');
                return {
                    cancel: true
                };
            }else{
                return {
                    cancel: false
                };
            }
    }

    
    function checkBlockRequest(){
                console.log('blocking start');
                chrome.webRequest.onBeforeRequest.addListener( blockListener, { urls: ["<all_urls>"], types: [ 'main_frame' ] }, ['blocking'] );
        });
    }

    checkBlockRequest();//called
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