SPA best practices for authentication and session management

This question has been addressed, in a slightly different form, at length, here: RESTful Authentication But this addresses it from the server-side. Let’s look at this from the client-side. Before we do that, though, there’s an important prelude: Javascript Crypto is Hopeless Matasano’s article on this is famous, but the lessons contained therein are pretty … Read more

How to Detect Browser Back Button event – Cross Browser

(Note: As per Sharky’s feedback, I’ve included code to detect backspaces) So, I’ve seen these questions frequently on SO, and have recently run into the issue of controlling back button functionality myself. After a few days of searching for the best solution for my application (Single-Page with Hash Navigation), I’ve come up with a simple, … Read more

How to ajax-refresh dynamic include content by navigation menu? (JSF SPA)

A straightforward approach would be the following view: <h:panelGroup id=”header” layout=”block”> <h1>Header</h1> </h:panelGroup> <h:panelGroup id=”menu” layout=”block”> <h:form> <f:ajax render=”:content”> <ul> <li><h:commandLink value=”include1″ action=”#{bean.setPage(‘include1’)}” /></li> <li><h:commandLink value=”include2″ action=”#{bean.setPage(‘include2’)}” /></li> <li><h:commandLink value=”include3″ action=”#{bean.setPage(‘include3’)}” /></li> </ul> </f:ajax> </h:form> </h:panelGroup> <h:panelGroup id=”content” layout=”block”> <ui:include src=”/WEB-INF/includes/#{bean.page}.xhtml” /> </h:panelGroup> With this bean: @ManagedBean @ViewScoped public class Bean implements Serializable { private … Read more