Re-enabling window.alert in Chrome
Get your window.alert
back in Chrome in a jiffy with this one-liner:
Here originalAlert
refers to the native alert function of Chrome. Copy, paste and run this in Chrome's developer console. This resuscitates your standard alert functionality.
Initial scrutiny
Before diving deep, let's run some basic health checks:
- Chrome Settings: Confirm if settings or installed extensions in Chrome have deliberately silenced the alerts. Look into
chrome://settings/content/notifications
. - JavaScript Errors: Debug with a
console.log
to fish out any blunders muzzling your alerts. - Browser Testing: Run your
window.alert
in different browsers to diagnose if it's a Chrome-specific flu.
Deeper diagnosis
If the cure wasn't simple as we thought, here's a split up of the possible chrome ailments we should consider:
Chrome settings reset
Resuscitating Chrome to its plain vanilla settings helps discard any local configurations hindering alerts:
- Enter
chrome://settings/reset
in the address bar. - Press Restore settings to their original defaults.
- Confirm by clicking Reset settings.
Clear browsing history
Sometimes your browser's past haunts the present. Corrupted data may pose issues with JavaScript outputs:
- Navigate to
chrome://settings/clearBrowserData
. - Check both boxes: Cached images and files and Cookies and other site data.
- Select Clear data.
Then, refresh your web page for the changes to take effect.
Extensions and overrides
Extensions may hijack functionality, while DevTools can assert overrides on script execution:
- Disable extensions one by one to fish out the meddler.
- Leverage Chrome DevTools: Enter
F12 -> Sources -> Overrides
to reveal any scripts intentionally sabotaging the alerts.
Was this article helpful?