{"id":411,"date":"2012-12-04T02:42:59","date_gmt":"2012-12-04T07:42:59","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/acts\/?p=411"},"modified":"2012-12-06T12:04:18","modified_gmt":"2012-12-06T17:04:18","slug":"avoiding-page-reloads","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/acts\/2012\/12\/04\/avoiding-page-reloads\/","title":{"rendered":"Avoiding Page Reloads"},"content":{"rendered":"<p>My applications are part of a framework (LMS) that load a billion extra items on each page load.<\/p>\n<p>To get around it I wanted to do that silly &#8220;twitter thing&#8221;. They&#8217;re the ones who get credited with it because for years normals were baffled by their url changing.<\/p>\n<p>http:\/\/www.adequatelygood.com\/2011\/2\/Thoughts-on-the-Hashbang<\/p>\n<p>Additionally, if you&#8217;re interested in why the bang(!) is necessary, it&#8217;s not. It&#8217;s just to tell google to index the page. Otherwise they assume it&#8217;s just an anchor link.<\/p>\n<p>https:\/\/developers.google.com\/webmasters\/ajax-crawling\/<\/p>\n<p>So I spent the last few hours changing all links in one of my current applications to do a &#8220;hashbang&#8221; sort of call instead of loading new pages. This significantly increased speed when using our clunky LMS. <\/p>\n<p>This was especially annoying because our LMS forces changes with &lt;a&gt; tags. <\/p>\n<p>What made this especially easy to implement was that I had already made all links go through a smarty plugin so altering all links in the application was just in one file and I could make those links specific to whatever authentication scheme \/ LMS the application is living in. So I just had to alter that plugin and the LMS specific layout and bam. The only thing that&#8217;s not covering is form submissions. But there are only a couple of those, so I&#8217;m not going to stress about that.<\/p>\n<p>In continuing research obviously I had to investigate why twitter moved away from hashbangs.<br \/>\nhttp:\/\/engineering.twitter.com\/2012\/05\/improving-performance-on-twittercom.html<\/p>\n<p>The highlight of that being that with hashbangs, you have to go to the client and then back out, which reduces speed on the initial pageload. So twitter went a little fancier 6 months ago and used the history api&#8217;s PushState. <\/p>\n<p>Implementing the hashbang urls was a very small amount of code, so I&#8217;m going to move forward with that for now, maybe next time I get a chance to do some research I&#8217;ll focus on converting that to PushStates.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My applications are part of a framework (LMS) that load a billion extra items on each page load. To get around it I wanted to do that silly &#8220;twitter thing&#8221;. They&#8217;re the ones who get credited with it because for years normals were baffled by their url changing. http:\/\/www.adequatelygood.com\/2011\/2\/Thoughts-on-the-Hashbang Additionally, if you&#8217;re interested in why [&hellip;]<\/p>\n","protected":false},"author":4571,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63924,17295,63928],"tags":[64039,111293,63971,3261],"class_list":["post-411","post","type-post","status-publish","format-standard","hentry","category-atg","category-javascript","category-quizmo-atg","tag-hashbang","tag-javascript","tag-smarty-2","tag-twitter"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/posts\/411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/users\/4571"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/comments?post=411"}],"version-history":[{"count":4,"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/posts\/411\/revisions"}],"predecessor-version":[{"id":413,"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/posts\/411\/revisions\/413"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/media?parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/categories?post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/acts\/wp-json\/wp\/v2\/tags?post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}