Remove window.alert after interval

Soldato
Joined
27 Dec 2005
Posts
17,288
Location
Bristol
Is it possible to automatically ok/remove/override an JS window.alert prompt after a set amount of time? I've tried using setInterval to reset the alert to "" after 5 seconds but it doesn't work and my Googlefu is failing me (delete/remove etc are too vague terms).
 
Soldato
OP
Joined
27 Dec 2005
Posts
17,288
Location
Bristol
It's just a simple thank you alert, but it's on a point-of-sale system so I don't want it blocking the page after the customer has left.

And yeah I'll probably have to look at a lightbox or div popup but it's far more faff than removing an alert (if it were possible!).
 
Associate
Joined
12 Dec 2009
Posts
625
Location
Gloucester, UK
It's just a simple thank you alert, but it's on a point-of-sale system so I don't want it blocking the page after the customer has left.

And yeah I'll probably have to look at a lightbox or div popup but it's far more faff than removing an alert (if it were possible!).

Yeh alerts are very obtrusive and not very user friendly. I would definitely recommend a modal as per suggested above, which is essentially making a div appear over the top of the site.
 

AJK

AJK

Associate
Joined
8 Sep 2009
Posts
1,722
Location
UK
It's just a simple thank you alert, but it's on a point-of-sale system so I don't want it blocking the page after the customer has left.
Javascript alerts are absolutely not the right way to do this.

And yeah I'll probably have to look at a lightbox or div popup but it's far more faff than removing an alert (if it were possible!).
Really? Many big frameworks will give you a modal dialog in a few lines of code, and it's not difficult to roll one yourself. Or just display a message somewhere on screen which clears itself after a few seconds. If it's "just a simple thank you alert" it doesn't seem like something which needs to take over the whole screen, does it?
 
Back
Top Bottom