google chrome alert() is unusable, should be removed
in latest google chrome, the alert() function is unusable - forces unexpected opening of tabs and windows, blocks most tab controls, alert dialog cannot be blocked, etc.
for this reason we should not use the alert() function for routine user interaction, such as reporting rpc errors. I guess simple things like confirming run start and stop is still okey.
K.O.
Comments (7)
-
-
reporter Pages with alert(): (there is also some alerts in midas.js and mhttpd.js)
- alarms.html - messages.html - programs.html - start.html
K.O.
-
Then why don't you replace those with dlgAlert() and give it a try?
-
reporter Done. But there is still some alerts thrown by code in mhttpd.js, some of it is code used to load every page. To replace them with dlgAlert, we need to have the dialog html div present on every page. Right now not sure how to do this. Maybe crete this div from mhttpd_init(), same as the menu buttons are populated? K.O.
-
Not necessary to create a <div> on every page, since dlgAlert creates this element dynamically via
d = document.createElement("div"); document.body.appendChild(d);
-
reporter done. last use of alert() removed in commit eaad548. K.O.
-
reporter - changed status to resolved
fixed in commit eaad548. K.O.
- Log in to comment
I wrote two new functions dlgAlert(string) and dlgConfirm(string, callback) which can replace alert() and confirm(). The new functions are however not blocking (nothing should be blocking in JavaScript), so you have to supply a callback function to dlgConfirm which gets called with true or false depending on what the user presses.