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

139
Views
Close site on user click on div

I want my website to be closed on a custom close div or button. That's because the page may have many previous pushShates so clicking the browsers back button will take to the previous page. So, I want when user clicks the button my website will close.

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

0

window.close(); 

Should close the current tab which the user sees. It only closes the current tab though. Add this as an event to your div and when the user click on it, it would close the current window.

about 4 years ago · Juan Pablo Isaza Report

0

If you're talking about closing your current tab then you can just use the function below.

window.close();

Just use a workaround through redirecting the window to something else cause this problem is pretty self-explanatory, it doesn't allow closing window that is not opened by it through JS. There's nothing can be done so use the method below

window.location.href = 'your redirection here';
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!