below script will only work in Firefox.if we enable the settings allow_scripts_to_close_windows.
For that
1.Open FireFox
2.Enter about:config
in Address bar
3.It will open a Config page of Firefox
4.Search allow_scripts_to_close_windows
5.It will show allow_scripts_to_close_windows
.by default value will be false.To enable double click on the allow_scripts_to_close_windows
row.It will change to true
6.Close Firefox
Then execute the below script.
<script>
var basket = prompt("are you a basket case (yes/no) ?");
if (basket === "yes")
{
window.close()
}
var vegtables = prompt("How many times do you eat vegtables at least once a day in a week ?");
if (parseInt(vegtables) >= 6) {
alert("Good job! keep it up!")
}
else {
alert("You need to eat more vegtables, visit my health and reboot pages!")
}
</script>
12
solved I want to close the website if the user answers yes [duplicate]