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 938581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:40:03+00:00 2026-05-15T21:40:03+00:00

Yes, I realize this is horrible UI and bad accessibility wise, but I am

  • 0

Yes, I realize this is horrible UI and bad accessibility wise, but I am forced to seek out the options due to contracted work ( to which I didn’t initially agree upon and am stuck with ).

I know that you can assign an event handler to onbeforeunload like:

window.onbeforeunload = function() {
    return 'You have unsaved changes!';
}

That would bring about a dialog generated by the OS/browser which cannot be customized. It would ask you to Cancel your request or go on.

So far it seems the only way I can display any custom-ness is by inserting a window.open in that event handler:

window.onbeforeunload = function() {
     var x = window.open('modal.html');
}

This would most likely get blocked by any modern browser as a “popup”. I have to display an entirely new page with my dialog, but this seems to be the only way to meet the demand.

Is this pretty much the only option I have? Other than forcefully telling the client it isn’t recommended to do this?

The only other option would be relying on the user to hit “Cancel request” and then insert the dialog.

Questions I have already looked at:

  • jQuery UI Dialog OnBeforeUnload
  • How can I override the OnBeforeUnload dialog and replace it with my own?
  • 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-05-15T21:40:04+00:00Added an answer on May 15, 2026 at 9:40 pm

    I just went the window.open route onbeforeunload.

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

Sidebar

Related Questions

Yes, I realize this question was asked and answered, but I have specific questions
So I realize this question sounds stupid (and yes I am using a dual
Yes, I have searched and tried many techniques, but nothing seems to work. Here
Yes, I know this question has been asked before, but I can't find an
Yes, I know this question has been asked a lot of times, but I
I have an emergency issue at hand. First off, yes, I realize this was
I'm creating a class that creates arrays. (Yes, I realize that's already available in
This might sound stupid, but why doesn't the Java compiler warn about the expression
Having read some postings here about this topic, I realize that there are quite
I've seen a number of posts on this subject, but none that leave me

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.