Firefox add-on Session Alive

Arun
10 min read
Featured Image

Session Alive Firefox add-on provides an important feature for testers as well as developers; keep the session alive for any website, even the user is inactive for long period of time.

Requirements

Session timeout is great functionality and the best practice is to keep it as minimum as possible. For development and testing, session timeout creates an additional burden to login again if you are inactive for some time.

Similar extensions

Staying alive is a Chrome extension which fulfills these requirements in Chrome. A Firefox alternative is missing. There are many extensions available for reloading the pages, but a "fit and forget it" solution is required.

Firefox WebExtensions

Several years ago, Mozilla introduced WebExtensions to make it easier to develop extensions across multiple browsers. This architecture takes advantage of newer technologies, shortening time taken to review the extensions as well as improving protection against spyware and adware. This extension is based on this architecture.

Main Components

  • Settings page
  • Information pop-up
  • Page reload time & Notifications

Settings page

A rule should be created in settings page to run the add-on on a website. A Rule should either contain Background Request or a Foreground Request with following items:

  1. Rule Name
  2. Trigger URL
  3. Request Interval

Give a short name to identify the rule in the Rule Details:

Rule Details
Rule Details section

Background Request Options:

Background Request
Background Request section

The Background request option can be selected if the session alive requests need to happen silently in the background without reloading the current page. The requests to keep the session alive happens in the background using AJAX requests.

Example 1: keep session alive for the web application with a dashboard at https://myapp.com/welcome with session time-out set at 8 minutes by the web server.

  • Trigger URL: https://myapp.com/welcome
  • Request interval: 5 minutes
Result: When the user login and the dashboard is displayed, the session alive rule is started and the Trigger URL is requested in every 5 minutes to keep the session alive.

Example 2: keep session alive for the web application with a resource heavy dashboard at https://myapp.com/dashboard and a user page of https://myapp.com/user with session time-out set at 8 minutes by the web server.

  • Trigger URL: https://myapp.com/dashboard
  • Background request URL: https://myapp.com/user
  • Request interval: 5 minutes
Result: When the user login and the dashboard is displayed, the session alive rule is started and the Background request URL is requested in every 5 minutes to keep the session alive.

Foreground Request Options:

Foreground request options
Foreground request options section

The Background request rule may not be enough to keep session alive, if website idle timer is implemented in JavaScript in the website itself. The Background request rule keeps the session alive by auto-reloading the current page at the set auto-reload interval. The user need to set the Trigger URL such as the web application URL should starts with the Trigger URL else the rule will be stopped.

Please note the following:

  • A count-down timer is displayed 30 seconds before page reloads automatically.
  • A beep sound played 10 seconds before page reloads automatically.
  • Any unsaved data in the page may be lost when the page reloads automatically.
  • Browser will show a warning dialog if any form submission is repeated by the page reload.

Notification options:

Notification option
Notification option section

Browser notifications can be set for the following:

  • Background Page request successful to keep session alive
  • Background Request is stopped because server response is not 200
  • Page is auto-reloading to keep session alive
  • Foreground Page auto-reload stopped

Installation:

Install from the Add-ons for Firefox website.

Update on August 3, 2022: Now this addon is available in Chrome and Edge browsers also. Install from the chrome web store

Table Download add-on

Arun Arun
5 min read

Capture Screenshot add-on

Arun Arun
5 min read

Link Validator tool

Arun Arun
5 min read