Auto-Save Widget

The Auto-Save Widget is bundled with XWiki and it is used to enable the periodical automatic saving of a document. 


To enable the automatic save, just select the "Autosave" checkbox next to the action buttons. Additionally, you can change the interval (in minutes) by specifying an integer value in the dedicated input.


To use the Auto-Save widget, start by creating a wiki page and include the following JavaScript resource files:

  • js/xwiki/editors/autosave.js
  • js/xwiki/actionbuttons/actionButtons.js - this script file is necessary because the autosave.js depends on it. Even though actionbuttons.js is already pulled when generating the action buttons, the call is made after the wiki page content has been executed, so you have to explicitly include it.

You can additionally include the js/xwiki/editors/autosave.css file, for the case you need to display the widget UI.

$xwiki.jsfx.use('js/xwiki/actionbuttons/actionButtons.js', true)##

Next, add an "XWiki.JavaScriptExtension" object with the following code

document.observe('xwiki:dom:loaded', function() {
 new XWiki.editors.AutoSave({
    form : 'inline',
    enabled: true,
    frequency: 1,
    showConfigurationUI: true

which indicates that the auto-save UI will be displayed in "Inline" mode and the page will be automatically saved every minute.

Finally, edit the page in "Inline" mode and you should see the screen below:


Parameters of the XWiki.editors.AutoSave Constructor

ParameterDescriptionDefault value
formThe ID or DOM node to save.xwikieditcontent which is the main form in wiki edit mode.
enabledA flag describing the initial state of the auto-save. If false, the user has to click the "Autosave" check-box in order to activate it.false
frequencyThe interval in minutes between consecutive saves.5
showConfigurationUIA flag stating whether the auto-save UI is displayed or not.true
disabledOpacityA number between 0 and 1 which sets the opacity of the frequency input when the auto-save is disabled.0.2

Related Pages

Trying to decide between Cloud and On Premise? See the comparison on the XWiki Help Center.

Search this space