{"id":2200,"date":"2022-08-30T15:22:53","date_gmt":"2022-08-30T15:22:53","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/04\/who-closed-the-browser-tab-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:22:53","modified_gmt":"2022-08-30T15:22:53","slug":"who-closed-the-browser-tab-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/who-closed-the-browser-tab-collection-of-common-programming-errors\/","title":{"rendered":"Who closed the browser tab?-Collection of common programming errors"},"content":{"rendered":"<p>I feel retarded.<\/p>\n<p>So, days of investigating this issue I discovered that my code was invoking a function in case of a network error and this function was invoking <code>close()<\/code>. Instead of resolving to my class&#8217; <code>close()<\/code> method, it resolved to <code>window.close()<\/code> instead. Guess what happened next? \ud83d\ude42 The tab closed.<\/p>\n<p>What made this problem particularly difficult were two Chrome-specific bugs:<\/p>\n<p>In short: <code>window.close()<\/code> works when it shouldn&#8217;t, and when it fails it does so silently.<\/p>\n<p>Anyway, I consider this matter closed. I hope this helps others avoid making the same mistake in the future.<\/p>\n<p id=\"rop\"><small>Originally posted 2014-01-04 14:17:51. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I feel retarded. So, days of investigating this issue I discovered that my code was invoking a function in case of a network error and this function was invoking close(). Instead of resolving to my class&#8217; close() method, it resolved to window.close() instead. Guess what happened next? \ud83d\ude42 The tab closed. What made this problem [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2200","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2200"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2200\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}