A Chrome extension for managing Chrome in the context of a public kiosk (like a photobooth). Features include:
- scheduled deletion of session data if the browser is idle
- whitelist of navigable URLs
- blocking of opening new tabs and fully closing the browser
- Injection of custom JavaScript into every page
- Node.js installed
- Grunt.js installed
- Bower installed
- CoffeeScript installed
git clone git@github.com:mattpetrie/kiosk-manager-chrome.git
cd kiosk-manager-chrome
npm install
bower install
Generate the complete packageable extension into the dist/ directory
grunt build
- Open Google Chrome
- Navigate to chrome://extensions
- check the "Developer Mode" box in the upper right corner
- click "Load unpacked extension..." and select the $PROJECT_ROOT/dist directory
- Make sure the
Enabled
checkbox is checked for the extension to use it
By default the extension will delete all browsing data including cookies, browsing history, etc. from Chrome when the sessionManager.resetSession
method is called.
To prevent your data from being deleted, open Chrome in a sandboxed session from the terminal: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/kiosk-manager-user/ google.com
You can also comment out the call to @clearBrowsingData()
from the sessionManager.resetSession
method before building.
The grunt build
task creates a packaged version of the extension in the package/ directory. Drag and drop this file into Chrome's chrome://extensions page to install.
The extension's options page is can be navigated to by clicking the options link on the chrome://extensions page. Options include:
- Set a home page URL for your application
- Set the idle time limit before the browser is reset
- Set a whitelist of allowed domains the browser can navigate to, using comma separated values
- Block users from opening new tabs in the browser
- force the browser to reopen if the Chrome window is closed
- Paste in JavaScript to be executed on each page
There are two ways to include additional JavaScript for the extension to execute on each page:
-
Small amounts of JS code can be pasted into the 'JavaScript to inject' field in the options page. Code placed here will be executed every time a new page loads.
-
You can add additional content scripts to the app/scripts/content-scripts/ directory before building the extension. Scripts added here must be added to the extension's manifest file in app/manifest.json before building. Files added here will be automatically minified by the Grunt task at build time.
Images, icons, CSS, additional JavaScript, etc. that is used by any added content scripts must be added to the extension's registry of web accessible resources. These files can be added to the app/scripts/resources/ directory to be automatically added to the manifest.
The extension exposes a kioskSessionDomApi
object to the DOM which you can access from your app's JS code to trigger session management events. The methods provided are:
.resetSession
- fully resets the current browser session, including deleting all cookies and browsing data, closing extra tabs/windows, and redirecting to the home page URL..clearPersonalInfo
- removes all cookies, browsing history, and other session data from the current browser sessionchangeResetInterval
- changes the interval at which the idle detection will reset the brower session. This last only for the current browser session. To permanently change the interval it should be set in the extension's options page.tempResetInterval
- changes the idle detection reset interval for the current page only. The timer will revert to the default interval upon navigation away from the page. Useful if you want to have a longer or shorter idle timeout for a specific page like a home page.
If you choose to add any additional content scripts, the extension also exposes a kioskSessionCSAPI
for use in your content scripts. The methods provided are the same as the DOM API above.
Kiosk icon designed by Ahmed Elzahra from the Noun Project.