Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

426
Visualizações
Super simple script runs on some pages, not others. Why?

I have a super simple script (running in a Userscript manager for Safari) that works on some pages but not all.

Here is the script:

// ==UserScript==
// @name           Close tab on double click
// @include        https://*
// ==/UserScript==

                                  
document.addEventListener("dblclick",function (event) {
    window.close();
            });

For some reason, it works on Stack Overflow, Reddit post pages, etc., but does NOT work on Reddit homepage, Google (homepage or search results), etc.

Why?

Thanks for any insight. I'm still a newbie about javascript.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In a chrome browser, when I add the JS function in the console and then double click on the page I get this notification (I tried the stack overflow site): Console Image

My guess is your userscript manager may add the script you write differently depending on the website, and the websites that don't work are because of this warning. Try opening your console after you add the script and see if you get this warning when double clicking does not work.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda