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

86
Views
Replacing a tab with a different one using JS

Currently, I have something in place that opens a new tab with some html code, using

    const winUrl = URL.createObjectURL(new Blob([final_file], { type: "text/html;charset=utf8" }));
    const win = window.open(winUrl);

where final_file is some html that I generate. I want to make it so instead of opening a new tab every time, if such a tab is already open, it should replace it. I tried using frame names in window.open, but I was told that they are deprecated and shouldn't be used. What do I do?

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

0

You should place dedicated window name (target as second argument to .open) to your opened window, so browser would know to replace it instead of opening new window:

    const winUrl = URL.createObjectURL(new Blob([final_file], { type: "text/html;charset=utf8" }));
    const win = window.open(winUrl, 'my-window');

target is not deprecated.

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!