Category: Coding

Home / Coding
Post

How to detect a device type, based upon window width

These days, it seems like there are an almost infinite number of device types.  There are phones, tablets, phablets (AKA really big phone), small laptops (like netbooks), big laptops, and desktops.  The key to dealing with these devices is simply responsive design and extensive compatibility testing.  You should not deviate from that! With that said,...

Post

How to handle pagination in ColdFusion

So, you have a task where you are supposed to display X items but only Y items per page and only link to Z pages at any one time?  This can be a fairly complex task.  I figured that I would offer my ~80 line solution to the problem. Here’s an example of what the...

Post

How to easily consume and display RSS in JavaScript

I came across this issue a few years ago and just recently found a good solution.  JavaScript has the ability to make an AJAX request to whatever page you want, and return the result.  The problem is that the same origin policy, enforced by most browsers, won’t allow you to return most content if it originates from outside...

Post

How to use localStorage to remember form values

Since finishing my last post, I’ve been wanting to work on a way of implementing the concepts.  Let’s say you have a long form (like a job application) or a form you would be filling out a lot (like shipping/billing information).  You could use ajax to store the information server-side but let’s say you need or want...

Post

How to store JavaScript values persistently, locally

So, you want to store data on the client side?  There is a method called localStorage.  Let’s do a simple example.   [gist id=4056935 file=StoreArraysInLocalStorage-Part1.html]   This very simple example simply writes the “coffee” values from the local variable, to localStorage, and back to another local variable but it shows the potential of localstorage. Let...