Requests for comment/Live preview

A proposal to update the code in the UserPreference "Use live preview (experimental)".

Request for comment (RFC)
Live preview
Component General
Creation date 2014-10-26
Author(s) Quiddity
Document status Declined
See Phabricator.


We currently have Live preview as a default part of MediaWiki. It was created in 2007 (?) and hasn't changed much since. There are various newer and better userscripts.


I suggest merging the best bits of all the alternatives, into a single [gadget/extension/core feature] that can be used at all wikis (WMF and elsewhere).

I also suggest renaming it (because it's not "live" in the sense of concurrent, it's just quicker than default) to "fast preview" or similar.

A table comparing features.

Feature standard preview Manual:Live preview (code: git) w:User:Js/ajaxPreview (code: .js) w:User:Anomie/ajaxpreview.js wikEd code: [1] w:User:Pilaf/InstaView
Preserve undo history  N          
Retain cursor position  N      N    
<ref>, <references />  N  N        N
<ref name=""> defined outside edited section  N  N  N      N
Configurable button location n/a Takes over the default submit buttons   (config)  N    N
Not scrolling to top on preview  N  N   configurable, on by default  N   (see wikEd help for scrolling buttons and shortcuts) ?
<syntaxhighlight> (GeSHi) on non-.js/.css pages        N    N
<categorytree>            N
<math>            N
Raw watchlist editing preview  N  N  N  N    N
Hovercards (beta)        N   (upcoming version)  N
Media viewer (video clip) support    N WIP, see T74675  N  N   (upcoming version)  N
Server interaction method full page reload 1 json POST to api.php 1 json POST to api.php 1 json POST to api.php 1 html POST to api.php or 1 html non-API POST to index.php, uses Live preview if possible local
Remarks - - - - gadget on many Wikimedia wikis
(incl. up to ~56,000 users on Wikipedias, per m:Gadgets)
- Internet Explorer not supported
outdated code, not actively developed


  • Most of the other variants I can find - e.g. w:User:CBM/quickpreview.js, fr:MediaWiki:Gadget-QPreview.js, etc - are based on Alex Smotrov's original script, which is what "User:Js/ajaxPreview" is from. Alex seems to have not edited in ~1 year, but I'll email him for feedback (and to thank him for the excellent scripts :).
  • There are two comments by TheDJ and Anomie in this 2012 thread that might be relevant, specifically:
    "The problem with all of them, is that they are unable to load JS and CSS that is specific to your view. So for instance, if you add a video, then preview, the JS code to handle the video won't be loaded. This is one of the primary reasons this functionality isn't on by default yet I presume. —TheDJ (talkcontribs) 23:23, 15 September 2012 (UTC)"
    "AFAIK, all of the currently available options do in fact use the servers anyway; most are posting to the MediaWiki API, while the "live preview" option in the preferences seems to contact its own private "API" on the servers. The VisualEditor and Parsoid projects may change this. Anomie 02:20, 16 September 2012 (UTC)"

Please add/fix further details or scripts, to the table. Thanks!

No script can reliably activate video clips, please help fixing this (see bug 72675). Cacycle (talk) 10:06, 4 November 2014 (UTC)
  • RFC was removed from consideration. The reason being that it is mostly already implemented or underway to being implemented.


  1. wikEd code: User:Cacycle/wikEd.js, see the following consecutive functions: wikEd.LocalPreview(), wikEd.LocalPreviewAjaxHandler(), wikEd.GetArticleText(), wikEd.GetArticleTextAjaxHandler(), wikEd.ParseNamedRefs(), and wikEd.FilePreviewAjaxHandler()