Gone single page

Created: 2017/03/07 16:51:33+0000

My latest website update takes it to a new place, it has gone single page. Now internal links will generally cause a partial replacement of page. I didn't use any frameworks and was able to reuse much of my existing code.

Clicking links is intercepted and the link is checked to see if it is possible to load the content into the existing page. If it is, an HTTP request is made for a JSON document, the document contains the HTML snippet and some metadata. The HTML is generated on the server using existing code. Once the response is received the client replaces it current content with the new content in the JSON document and updates the metadata. It pushes some information into the browser history API and it looks like an ordinary but fast navigation event.

The client and server now both have much less work to do and less to transfer. The server continues to render all HTML content as before so it shouldn't adversely affect search engine ranking. It takes less than two hundred lines of JavaScript to enable on the client. I've yet to find the down side. Single page applications are the present.