Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

beforeunload Custom message in FF and Chrome

Posted on 2016-07-15
11
Medium Priority
?
785 Views
Last Modified: 2016-07-30
I know you can add a custom message to the alert box on "beforeunload" in IE but I can't find how to do it with FF or Chrome.  Is this a functionality of the browser that disallows this or is there a work around?
0
Comment
Question by:rgranlund
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 41713191
This page http://www.w3schools.com/jsref/event_onbeforeunload.asp says it is supported in all browsers though it may be how you are coding it.
0
 
LVL 7

Author Comment

by:rgranlund
ID: 41713206
@dave if you go to that page and then "try It Yourself"  you will see that it does not work in Chrome: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onbeforeunload_html
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 41713228
Works just fine from here with Chrome in both XP and Win7.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Author Comment

by:rgranlund
ID: 41713272
It won't return a custom message for me.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 41713276
The demo page works fine.  Show me the code you're trying to use.
0
 
LVL 7

Author Comment

by:rgranlund
ID: 41713374
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>
window.onbeforeunload = function() { return "text"; }
</script>

Open in new window

0
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 41713457
firefox doesn't show the custom message
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 41713504
0
 
LVL 7

Author Comment

by:rgranlund
ID: 41713541
So, from that article does it mean it is not possible?
0
 
LVL 83

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 total points
ID: 41713553
it is a function of the browser only IE and Edge will show the custom message.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 41713643
That says that Firefox will not display the message.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question