+ 3

window.onunload not working

I added the following lines to this code: window.onunload = function() { alert("Thank You!"); }; It doesn't seem to display the pop up. What's wrong? https://code.sololearn.com/WQ9vNh4dJsMF/?ref=app

10th Feb 2022, 8:05 PM
Harsha S
Harsha S - avatar
5 ответов
+ 1
It's working for me. Check again by adding alert()
10th Feb 2022, 8:10 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 I need the alert when I exit from the output screen
10th Feb 2022, 8:13 PM
Harsha S
Harsha S - avatar
+ 1
Like <input type = "number" id = "celsius" value = "0" placeholder ="Celsius" onfocusout="alert(value)"> ?
10th Feb 2022, 8:20 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 is window.onunload not used here?
10th Feb 2022, 8:34 PM
Harsha S
Harsha S - avatar
+ 1
Oh I read it as onload!! 😔 but Where are using? I tried by adding... For me its getting 'Blocked alert on unload' message. .. I think may not work here, sry Not sure...
10th Feb 2022, 8:56 PM
Jayakrishna 🇮🇳