Unexpected alert.
242 }
243 else {
244 localStorage.setItem('skipgc', 't')
245 alert('GoatCounter tracking is now DISABLED in this browser until ' + location + ' is loaded again.')246 }
247 }
248
Unexpected alert.
238 if (location.hash === '#toggle-goatcounter') {
239 if (localStorage.getItem('skipgc') === 't') {
240 localStorage.removeItem('skipgc', 't')
241 alert('GoatCounter tracking is now ENABLED in this browser.')242 }
243 else {
244 localStorage.setItem('skipgc', 't')
Description
JavaScript's alert
, confirm
and prompt
functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation.
Furthermore, alert
is often used while debugging code, which should be removed before deployment to production.
Bad Practice
alert("here!");
confirm("Are you sure?");
prompt("What is your name?", "John Doe");
Recommended
customAlert("Something happened!");
customConfirm("Are you sure?");
customPrompt("Who are you?");
function foo() {
const alert = myCustomLib.customAlert;
alert();
}