Override window.alert
For years the only bit of feedback web developers could get was via alert("{str}")
calls. These days we have the web console but, in rare cases, we don't have a console and alert
calls are our only window into a value at a given time.
One problem: if an alert
sneaks into production code, your site looks like it's been hacked. Your site looks like it's malware! To prevent any of those issues, you can add this snippet to your production build:
window.alert = console.log
This tiny line of JavaScript could save your site from catastrophe. There are many cases for overriding native functionality and this is a great example!
Today we get to play amazing games on our super powered game consoles, PCs, VR headsets, and even mobile devices. While I enjoy playing new games these days, I do long for the retro gaming systems I had when I was a kid: the original Nintendo...
With Firefox OS, asm.js, and the push for browser performance improvements, canvas and WebGL technologies are opening a world of possibilities. I featured 9 Mind-Blowing Canvas Demos and then took it up a level with 9 Mind-Blowing WebGL Demos, but I want to outdo...
Mobile and desktop browser vendors do their best to help us not look like idiots by providing us autocomplete, autocorrect, and autocapitalize features. Unfortunately these features can sometimes get in the way; we don't always want or need the help they provide. Luckily most browsers allow...
"Copy to clipboard" functionality is something we all use dozens of times daily but the client side API around it has always been lacking; some older APIs and browser implementations required a scary "are you sure?"-style dialog before the content would be copied to clipboard -- not great for...
it’s an interesting idea, and I’m not saying the world is perfect, but if instead of using this to avoid pushing debug code onto production, how would I go about testing for stuff like alerts and other weird edge cases
In older IE browsers the browser will crash if console.log is called when the debug window is closed. Will this work then?
override window.alert in IE for logggint using $.ajax to call WebService or REST API ?