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 all versions of this script. Show only the versions where the code changed.

  • v0.11 08.03.2024.

    Change back the modifier requirement

  • v0.11 08.03.2024.

    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 28.03.2023.

    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 04.02.2023.

    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 17.11.2022.

    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 15.05.2022.

    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 19.04.2022.

    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 19.04.2022.

    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 15.01.2022.
    • Version 0.4: Added support for meta.wikimedia.org, which also offers a mobile version. Added screenshots to GreasyFork description.
  • v0.3 22.12.2021.

    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 27.11.2021.

    Better event detection to avoid triggering the shortcut while editing

  • v0.1 25.08.2021.