I would like to override the alert()
Javascript function, while preserving
its "focusing" behavior. I.e., customize the aspect, while bringing the focus to the browser tab where the popup is opened.
Asked
Active
Viewed 428 times
0

gcedo
- 4,811
- 1
- 21
- 28
1 Answers
2
It's not possible to directly customize/decorate the javascript alert box. What I would recommend doing is creating a custom alert modal, like the ones used by twitter bootstrap.
It's been asked in other stackoverflow questions (this one recommends jQuery UI's modal).
This alone won't bring the focus to the browser tab where the popup opened though. This answer provides a decent solution for that that works with firefox, using window.focus().

Community
- 1
- 1

johncorser
- 9,262
- 17
- 57
- 102
-
Will the bootstrap alert set the focus on its own tab? – gcedo Jul 01 '14 at 14:56
-
I edited my original answer. No, it doesn't focus the tab by itself, but you can use something like window.focus() in addition. – johncorser Jul 01 '14 at 14:58