Switch to Mobile Wikipedia/Wiktionary and Back, Autoload Mobile Page

Automatically loads Mobile Wikipedia if you visit the desktop version of Wikipedia from a different site; provides a shortcut to switch between the two and stays on the version you switched to.

These are versions of this script where the code was updated. Show all versions.

  • v0.11 2024-03-08

    Change back the modifier requirement

  • v0.11 2024-03-08

    Version 0.11: Fixed bug with the desktop-mobile switch, it was not keeping the query string parameters so this broke the redirect for "diff" pages.

  • v0.10 2023-03-28

    Version 0.10: Add REQUIRE_MODIFIER_FOR_SHORTCUTS option, set it to false to use only E and M to edit and switch to/from mobile, as opposed to having to use a modifier key like Ctrl or Alt. It is left as true by default to preserve the previous behavior.

  • v0.9 2023-02-04

    Version 0.9: disabled console.log debug messages by default. You can enable logs by changing LOG_DEBUG_MESSAGES from false to true in the script.

  • v0.8 2022-11-17

    Version 0.8: Added support for Wikibooks, and listed many more sub-domains of Wikimedia where the script shouldn't run, such as donate or login or maps (full list in DISABLED_ON_DOMAINS_REGEX). This is to avoid having the script break these pages and only run on actual wiki pages.

  • v0.7 2022-05-15

    Version 0.7: Added support for Wikiquote, which I had forgotten to include in this script. Also disabled support on wikitech.wikimedia.org, which does not have a .m alternative.

  • v0.6 2022-04-19

    Version 0.6: fix code for VIEW_HISTORY_IN_DESKTOP_MODE, which lets you view a wiki page's history in Desktop mode rather than mobile (even though the script would usually prefer mobile pages). This is because the mobile history view is severely limited, and you really can't do much with it. So now if you click on History in mobile view, it'll load the desktop page. If you still prefer to view this page in mobile mode, just change VIEW_HISTORY_IN_DESKTOP_MODE = true to VIEW_HISTORY_IN_DESKTOP_MODE = false in the script.

  • v0.5 2022-04-19

    Version 0.5: Added DISABLED_ON_DOMAINS_REGEX to provide an exclusion list for some domains where the auto-switch shouldn't run. For now just contains upload.wikimedia.org since it doesn't have a .m domain, but more domains will be added if needed.

  • v0.4 2022-01-15
    • Version 0.4: Added support for meta.wikimedia.org, which also offers a mobile version. Added screenshots to GreasyFork description.
  • v0.3 2021-12-22

    Two changes: one bug fix, and the script is now configurable.

    Bugfix: I fixed a bug that made the script load the wrong mode when an anchor link was present in the URL (e.g. #some-section): the script would add ?action=edit to the URL, which became #some-section?action=edit which is not how you load the edit page. It would just switch to non-mobile, but not edit.

    Config: There are now 3 boolean constants (true or false) at the top of the script to configure its behavior.

    I also took the opportunity to clean up the code and make it more resilient to this kind of issue in the future; it's now always rebuilding the URL from its core components rather than using string manipulation.

  • v0.2 2021-11-27

    Better event detection to avoid triggering the shortcut while editing

  • v0.1 2021-08-25