Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences

For details and instructions about other browsers, see Wikipedia:Bypass your cache.

/**
 * To use this script, add following line to your [[Special:MyPage/common.js]] (without the "*"):
 * importScript('User:Mabdul/saveandedit.js');
 */
/*global mw, $ */
(function () {
  var editButtons = document.getElementsByClassName('editButtons')[0];

  if (!editButtons || !document.editform) {
    return;
  }

  var conf = mw.config.get(['wgPageName']);

  $('<input type="button"/>')
    .val('Save and edit')
    .on('click', function () {
      saveandedit_prompt();
    })
    .appendTo(editButtons);

  // Function for returning
  function saveandedit_prompt() {
    mw.loader.using(['mediawiki.util', 'mediawiki.api'], function () {
      var section = mw.util.getParamValue('section');
      var summary = document.editform.wpSummary.value;
      // Some advertising
      summary += ' (using [[User:Mabdul/saveandedit.js|Save&Edit]])';

      var params = {
        action: 'edit',
        title: conf.wgPageName,
        text: document.editform.wpTextbox1.value,
        summary: summary
      };
      if (document.editform.wpMinoredit.checked) {
        params.notminor = '1';
      }
      // Check if only a section will be edited
      if (section) {
        params.section = section;
      }

      var api = new mw.Api();
      api.postWithEditToken(params).done(function (response) {
        if (response.edit.result === 'Success') {
          // Reload on the success
          location.reload();
        } else {
          // Handle out the error message
          var error = $.parseHTML( '<div><div class="error">Edit failed on ' +
            mw.html.element('a', { href: mw.util.getUrl(conf.wgPageName), title: conf.wgPageName }, conf.wgPageName ) +
            '</div> Best try it again (<b>Don\'t forget to copy the text!</b>). Error info: ' +
            (response.error && mw.html.escape(response.error.code + ' : ' + response.error.info)) +
            '</div>' );
          mw.notify(error, { autoHide: false });
        }
      });
    });
  }
}());