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

188
Views
replace '_blank' in javascript window.open links with '_self'

I'm trying to make a small chrome extension that will replaces the target in javascript window.open links but not sure how to approach.

this is an example link:

<a href="javascript:void(window.open('https://www.google.com','_blank','toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1'));">

Here I want to replace '_blank' with '_self' instead so all these links open in the same tab.

Edit: just noticed some of the links has __blank or _new so need to replace other variations.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you want to do this with all <a> tags, you can use a for loop:

for (let link of document.querySelectorAll("a")) { // Note: for/of was recently introduced
  link.href = link.href.replace("_blank", "_self");
};
about 4 years ago · Juan Pablo Isaza 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!