Skip to content

arunelias/session-alive

Repository files navigation

Session Alive

This add-on is used to keep the session alive for any website. Install and forget the session timeout messages.

Install from

Inspired by Dmitri Snytkine's wonderful Chrome add-on Staying Alive

Purpose

Session Timeout is great for Production websites, but not for Development and Testing. There are great add-ons for reloading webpages, but what about a "set it and forget it" solution?

Contents

Quick start

Get started creating a new Foreground Auto-Reload Rule with 1 minute interval.

Navigate to the Trigger URL in a new tab.


Main view (Information Pop-up)

The Main view is the informational page of the add-on where you can view the currently running Rules. Click the Settings button to open the Session Alive Settings page.

  • Running Rules information Currently running rules are displayed in a tabular format. The Rule Name, Set interval, Last Run time and Total Run Count is displayed. The Running rule can be canceled using the Cancel button.

The rule will start running again if the user navigates to the Trigger URL after canceling the rule. To prevent this, the rule can be disabled or deleted.

Rules

A Rule should either contain Background Request or a Foreground Request with following items:

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

Rule Details

The Rule Name can be set here. Give a short name to identify the rule. The rule can be set as disabled using the Disable the Rule check-box.

If the rule is running, changes made are applied when the rule is restarted. To restart the rule, cancel the running rule and navigate to the Trigger URL again to restart the rule.

Background Request Options

The Background Request Rule is used to keep the session alive by requesting a page in the background. The page reload is not required as the process happens in the background using AJAX requests. The following options are available in the Background Request Options:

  • Trigger URL:
    Navigating to the Trigger URL will start the background request loop. The background request URL is requested at the set Request Interval.

  • Background Request URL: (Optional)
    If background request URL is different from the Trigger URL, it can be set here. Otherwise the Trigger URL will be used by default.

  • Request Interval (in minutes): The background request URL is requested in a loop at the set Request Interval time. The minimum Request Interval is 1 minute, and only whole numbers can be set here.

  • Stop Background Request when server response is not 200 OK: The server response of the background request is analyzed and the loop can be stopped if the server response is not a 200 OK status. The response from server may indicate that the session has already expired.

  • Request Page header information (HEAD Request) only: When a background request fetches the URL, JavaScript code in the page is also executed. This may interfere with the page user is currently working with. To prevent this, HEAD request can be opted, which will only fetch the page header information.

If a website implements a JavaScript idle timer in the browser itself, the Background Request Rule will not be enough to keep the session alive. Use Advanced options or Foreground Auto-Reload options in this scenario.

Foreground Request Options

The Foreground Request Rule is used to keep the session alive by auto-reloading current page in the browser. The following options are available in the Foreground Request Options:

  • Foreground Auto-Reload Trigger URL:
    Navigating to any URL starting with the Trigger URL will start the foreground page reload loop. For example if Trigger URL is set to https://example.com/user/, navigating to https://example.com/user/profile or https://example.com/user/account/details will set to auto reload in the set Request Interval.

  • Foreground Auto-Reload Interval (in minutes): The page will auto-reload after the set Request Interval time. The minimum Request Interval is 1 minute, and only whole numbers can be set here.

  • Play beep sound before reloading page: Play a short beep sound 10 seconds before a page reloads automatically. The sound can be tested using the Test button.

A count-down timer will be displayed on the web page 30 seconds before it reloads automatically. Any unsaved data on the page may be lost when the page reloads. The browser will show a warning dialog if any form submission is repeated by the page reload. Please note that the count-down timer will not be displayed for web pages that uses FRAMESET element. However, page reloads automatically at the set interval.

Notification Options

Browser Notifications can be set here for the following conditions:

  • 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:

Background Request Advanced Options (To be Implemented)

These options can be useful when Background Request Rule is not enough to keep the session alive. The Background Request Rule alone is not enough when websites implements JavaScript idle timer in the browser itself.

This option requires a minimum knowledge of web programming to be able to properly use it.

The following options are available in the Foreground Request Options:

  • JavaScript code to insert to the page:
    The supplied JavaScript code is inserted to the page and executed. Trigger URL is required along with this code.

The code is executed in all the frames of the page, provided that the Same-origin policy is satisfied.

  • JavaScript Inject Trigger URL:
    The supplied JavaScript code is inserted to any URL starting with the Trigger URL. For example if Trigger URL is set to https://example.com/user/, the supplied JavaScript code is inserted and executed to pages https://example.com/user/profile or https://example.com/user/account/details on any tab of the browser window.
Example

For example: a web site uses jQuery session timeout plug-in for session timeout, setting the following JavaScript code will set the session timeout as 200 minutes.

    $.sessionTimeout({warnAfter: 9e6,redirAfter: 12e6});true;

Keep a return value or true; in the JavaScript code

Installation

  • Select correct branch for Firefox or Chrome
  • Download the repository.
  • Extract the ZIP file.
  • Go to about:debugging and load it as temporary extension

Browser compatibility:

 

Firefox Multi-Account Container Support:

Version 2.0 now Support Multi-Account Containers

What's next

TODO

Credits

Info

Session Alive is written and maintained by Arun
License: MIT