Manual:Live preview

Live preview is a feature of MediaWiki which allows showing a preview of an article or section on an edit form without reloading the remaining HTML code of the form.

Advantages

 * less incoming traffic: wikicode and all the menus are not received from the server again,
 * faster response time,
 * same cursor position in the editing window.

Disadvantage: only preview area is updated, which means:
 * interwiki, categories and used templates lists are not updated,
 * optional css files might be missing (e.g. if user adds &lt;source> tag),
 * scripts (such as sortable tables) are not executed.

Technical details
A live preview of an arbitrary MediaWiki markup string is returned if an appropriate flag is set when submitting a page via the "edit" action.

The following arguments to index.php should be passed via POST request:
 * 1) title=Page_Title
 * 2) wpPreview=true
 * 3) live=true
 * 4) wpTextbox1=String

The result is a preview of the string passed as the value of the wpTextbox1 field. This is similar to the result of  index.php parameter when viewing a page.

The title argument is actually used only if the string contains magic words such as.

Implementation
This feature should be exploited by JavaScript code with a "Live preview" button on the edit form. This button should submit the text with  flag and show resulting preview.

Live preview is currently disabled on Wikimedia projects, probably due to potential incompatibilities with some older browsers.

However, several userscripts are available, like qPreview and Quick Preview.

Also a script using built-in preview.js is possible.

Other uses
Live preview can be potentially used in a way other than in the edit form. For example, the current timestamp on the English Wikipedia is the 14-digit number within the result of the executing the following command:

Alternatives
A similar preview functionality is now implemented in API, using the parse function. As an example, the current time stamp can be obtained by:

Enabling live preview
Live preview is on or off depending on the $wgLivePreview variable of LocalSettings.php. To activate it you must also enable it on a per-user basis in the "editing" tab of you user preferences page.