Confirm()?

It’s also bad practice to use onload directly, since other scripts you might include may also be trying to use the load event. I’d also suggest losing the “variable for nothing” and literal / strict comparison.

window.addEventListener('load', function() {
	if (!confirm("Creating a (48 Slot) rack!")) {
		window.location.href = "../rooms/data.php";
	}
});

This way multiple scripts that need to hook onload can get along, and the overall code is simplified.

1 Like