Solved

beforeunload Custom message in FF and Chrome

Posted on 2016-07-15
11
125 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 82

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 82

Expert Comment

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

Author Comment

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

Expert Comment

by:Dave Baldwin
ID: 41713276
The demo page works fine.  Show me the code you're trying to use.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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 78

Expert Comment

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

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 78

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 82

Expert Comment

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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
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.

759 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

18 Experts available now in Live!

Get 1:1 Help Now