I want to display an alert on the page when a condition is met.

I want to display an alert on the page when a condition is met.

I know how to alert you after pressing the button.
I would like to refresh the page and get an alert if the conditions are met.
I'm sorry if my English is not good enough.