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

215
Views
How do i open a link in js with html code

Following js code refreshing the page to the url, but i wanna make it open in a new tab.

    case"example1":  case"example2":
     l.after('<meta http-equiv="refresh" content="0; url=https://example.com" /> Opening...'); ```
Can anyone help me about that?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Steps for opening a link in a new tab:

  1. Create an a element
  2. Set the href ( "https://example.com" )
  3. Set target to "_blank"
  4. Click on the link

Code:

<button onclick="myFunction()">Open</button>
<script>
function myFunction() {
  link = document.createElement("a")
  link.href = "https://example.com"
  link.target = "_blank"
  link.click()
}
</script>
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!