Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

425
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!