Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7756283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:47:00+00:00 2026-06-01T12:47:00+00:00

I know there is a very similiar question ( JavaScript: How to select "Cancel"

  • 0

I know there is a very similiar question (JavaScript: How to select "Cancel" by default in confirm box?) on this site, but I felt like I did not get a good answer out of that one as my premises are not the same.

Problem description: I am writing a web browser Javascript popup window that is supposed to take some information as input and the user can choose between “OK” to process the information and continue with whatever, or “Cancel” to close the window and go back to whatever. So far so good. The problem is that some users press “X” in the upper right corner of the popup to close the window (either by mistake or actually believing that the data is processed) and get a second dialog popup (you cannot change the text in this dialog) displaying “Are you sure you want to navigate away from this page?” – “Press OK to continue, or Cancel to stay on the current page” – OK/Cancel… Now, some of the users just press enter on their keyboard and oops, the popup is closed and all information is lost.

Question: Can you, or is there a workaround to set focus on “Cancel” instead of “OK” when it comes to the dialog of whether to close an Internet Explorer popup/tab or not?

Thank you in advance! =)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:47:02+00:00Added an answer on June 1, 2026 at 12:47 pm

    Unfortunately, I don’t think it’s possible to change focus on browser-generated dialog boxes.

    As Deestan suggested, maybe you can create a faux popup using js and css, and do whatever you want in terms of styling it, and still have the user enter information, and have the information passed to your code.

    From what i’ve heard/read, it’s generally accepted that using alert() or popup() for anything other than debugging is frowned upon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very narrow and specific question, but I know there are someone
I know there is this question that is very similar, but I wanted to
I know there is a very similar question here but I was hoping to
So I know that there is a very similar question to this all over
I know there is another question that exists similar to this one but I
I know there is more than one question out there that matches this, but
I know there have been a few threads on this before, but I have
This is very similar to a question I asked the other day but my
This is very similar to a question I asked the other day but my
I try to be very cautious with this question. There are at least three

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.