{"id":1024,"date":"2013-05-03T12:26:50","date_gmt":"2013-05-03T11:26:50","guid":{"rendered":"http:\/\/www.nathankowald.com\/blog\/?p=1024"},"modified":"2016-11-13T16:50:32","modified_gmt":"2016-11-13T16:50:32","slug":"bookmarklet-prevent-clicks-form-submissions-reloads-and-exits","status":"publish","type":"post","link":"https:\/\/www.nathankowald.com\/blog\/2013\/05\/bookmarklet-prevent-clicks-form-submissions-reloads-and-exits\/","title":{"rendered":"Bookmarklet: prevent clicks, form submissions, reloads and exits"},"content":{"rendered":"<p>I often mockup page changes using Chrome&#8217;s dev tools.<br \/>\nI&#8217;ll get a page just right, then later accidentally click a link or close the page and lose my changes.<\/p>\n<p><a href=\"http:\/\/www.nathankowald.com\/blog\/wp-content\/uploads\/2013\/05\/page-protect.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.nathankowald.com\/blog\/wp-content\/uploads\/2013\/05\/page-protect.png\" alt=\"page protect bookmarklet\" width=\"380\" height=\"175\" class=\"alignnone size-full wp-image-1063\" srcset=\"https:\/\/www.nathankowald.com\/blog\/wp-content\/uploads\/2013\/05\/page-protect.png 380w, https:\/\/www.nathankowald.com\/blog\/wp-content\/uploads\/2013\/05\/page-protect-300x138.png 300w\" sizes=\"auto, (max-width: 380px) 100vw, 380px\" \/><\/a><\/p>\n<p>This bookmarklet, once clicked will protect you from premature page exits.<br \/>\nIt disables link clicks, form submissions, page reloads and exits.<\/p>\n<p>Add it by going to this jsFiddle page, and dragging the green link to your bookmarks bar:<br \/>\n<a href=\"http:\/\/jsfiddle.net\/R7QKP\/\" style=\"font-size:2em; font-weight:normal; display:block; margin-top:8px;\">http:\/\/jsfiddle.net\/R7QKP<\/a><\/p>\n<p>Here&#8217;s the JavaScript:<\/p>\n<pre class=\"prettyprint lang-javascript\">\r\njavascript:window.onclick=function(){return false;},\r\nwindow.onsubmit=function(){return false;},\r\nwindow.onbeforeunload=function(){return 'Page Protection is enabled';};<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I often mockup page changes using Chrome&#8217;s dev tools. I&#8217;ll get a page just right, then later accidentally click a link or close the page and lose my changes. This bookmarklet, once clicked will protect you from premature page exits. It disables link clicks, form submissions, page reloads and exits. Add it by going to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[21,7],"tags":[],"class_list":["post-1024","post","type-post","status-publish","format-standard","hentry","category-bookmarklets","category-web-development"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/posts\/1024","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/comments?post=1024"}],"version-history":[{"count":59,"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/posts\/1024\/revisions"}],"predecessor-version":[{"id":1767,"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/posts\/1024\/revisions\/1767"}],"wp:attachment":[{"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/media?parent=1024"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/categories?post=1024"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nathankowald.com\/blog\/wp-json\/wp\/v2\/tags?post=1024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}