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

149
Views
Move to tab but don't reload

I'm using the code below with window.open to open a new link (same origin) in a new tab. If a tab with the new link is already open, the open tab should be focused instead.

This is all working fine, the focused tab is however always refreshed when it gains focus by this. How can I stop the focused tab from refreshing?

window.open(`./${_id}`, `module_${_id}`);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Check if the window is closed orelse use focus(), this should not refresh the page.

    var windowObject = null; // global variable
    
        function openURL(url) {
          if(windowObject == null || windowObject.closed) {
            windowObject= window.open(url);
          } else {
            windowObject.focus();
          }
        }

<button value="Check" onClick="openURL('https://www.google.com')"></button>
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!