Solved

beforeunload Custom message in FF and Chrome

Posted on 2016-07-15
11
193 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
  • 5
  • 4
  • 2
11 Comments
 
LVL 83

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 83

Expert Comment

by:Dave Baldwin
ID: 41713228
Works just fine from here with Chrome in both XP and Win7.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 7

Author Comment

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

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 79

Expert Comment

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

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 79

Accepted Solution

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

Expert Comment

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

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

815 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now