{"id":20,"date":"2008-04-09T19:44:05","date_gmt":"2008-04-10T02:44:05","guid":{"rendered":"http:\/\/chriscarey.com\/wordpress\/?p=20"},"modified":"2008-05-09T20:00:18","modified_gmt":"2008-05-10T03:00:18","slug":"preventing-infinite-alert-loops-in-javascript","status":"publish","type":"post","link":"https:\/\/chriscarey.com\/blog\/2008\/04\/09\/preventing-infinite-alert-loops-in-javascript\/","title":{"rendered":"Preventing infinite alert loops in Javascript"},"content":{"rendered":"<p>I found this code snippet which overrides the window.alert function to prevent an infinite loop.<\/p>\n<div class=\"codecolorer-container text blackboard\" style=\"overflow:auto;white-space:nowrap;width:565px;\"><div class=\"text codecolorer\">window.alert = function(s) {<br \/>\nif(!confirm(s))<br \/>\nwindow.alert = null;<br \/>\n}<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I found this code snippet which overrides the window.alert function to prevent an infinite loop. window.alert = function(s) { if(!confirm(s)) window.alert = null; }<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[10],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-development"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prpYG-k","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":0,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"wp:attachment":[{"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chriscarey.com\/blog\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}