davideisinger.com

My personal website
Log | Files | Refs | README

index.md (2261B)


      1 ---
      2 title: "Sessions on PCs and Macs"
      3 date: 2009-02-09T00:00:00+00:00
      4 draft: false
      5 canonical_url: https://www.viget.com/articles/sessions-on-pcs-and-macs/
      6 ---
      7 
      8 When switching from Windows to a Mac, one thing that takes some getting
      9 used to is the difference between closing and quitting a program. On the
     10 Mac, as one [Mac-Forums poster puts
     11 it](http://www.mac-forums.com/forums/switcher-hangout/99903-does-pushing-red-gel-button-really-close-application.html),
     12 "To put it simply...you *close* windows. You *quit* applications."
     13 Windows draws [no such
     14 distinction](http://www.macobserver.com/article/2008/07/03.6.shtml#435860)
     15 --- the application ends when its last window is closed. This may not
     16 seem like much of a difference, but it has serious potential
     17 ramifications when dealing with browsers and sessions; to quote the
     18 [Ruby on Rails
     19 wiki](http://wiki.rubyonrails.org/rails/pages/HowtoChangeSessionOptions):
     20 
     21 > You can control when the current session will expire by setting the
     22 > :session_expires value with a Time object. **If not set, the session
     23 > will terminate when the user's browser is closed.**
     24 
     25 In other words, if you use the session to persist information like login
     26 state, the user experience for an out-of-the-box Rails app is
     27 dramatically different depending on what operating system is used to
     28 access it (all IE jokes aside). I probably quit my browser three times a
     29 week, whereas I close all browser windows closer to three times an hour.
     30 Were I running Windows, this might not be an option.
     31 
     32 On my two most recent projects, I've used Adam Salter's [Sliding
     33 Sessions
     34 plugin](https://github.com/adamsalter/sliding_sessions/tree/master),
     35 which allows me to easily set the duration of the session during every
     36 request. This way, I can set the session to expire two weeks after the
     37 last request, independent of browser activity --- a much saner default
     38 setup, in my opinion.
     39 
     40 It's well-known that Mac users are [vastly over-represented among web
     41 developers](http://www.webdirections.org/the-state-of-the-web-2008/browsers-and-operating-systems/#operating-systems),
     42 so I think there's a distinct possibility that a silent majority of
     43 users are receiving a sub-optimal user experience in many Rails
     44 apps --- and nobody really seems concerned.