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.

Author
keyboard-shortcuts
Daily installs
0
Total installs
56
Ratings
0 0 0
Version
0.11
Created
2021-08-25
Updated
2024-03-08
License
MIT
Applies to

Switch to Mobile Wikipedia/Wiktionary and back, auto-load mobile page

This script will automatically switch to the mobile version of Wikipedia or Wiktionary if you visit the site from somewhere else.

I find the mobile version much more readable with its narrower column, while the desktop version has smaller fonts and lines that span the whole wide screen of my desktop computer.

The script also provides a shortcut to switch between mobile and non-mobile Wikipedia (see below). Note: Once you have switched, the script will keep the current mode as you click through articles, so that you don't load the desktop version, click on a link, and get switched back to mobile. This would be jarring. So the script keeps you in the last mode you switched to, and you can re-use the same shortcut at any time to switch back and again stay in the mode you last selected.

Configuration

You can configure this script by editing a few lines at the top:

  • If you want to disable the auto-switching to mobile mode on first visit, change AUTOLOAD_MOBILE = true; to AUTOLOAD_MOBILE = false;
  • If you want to disable the Ctrl-M/Alt-M mobile-desktop shortcut, change ENABLE_MOBILE_DESKTOP_SHORTCUT = true; to ENABLE_MOBILE_DESKTOP_SHORTCUT = false;
  • If you want to disable the Ctrl-E/Alt-E edit page shortcut, change ENABLE_EDIT_SHORTCUT = true; to ENABLE_EDIT_SHORTCUT = false;
  • If you want the E and M shortcuts to trigger without a modifier like Ctrl or Alt, change REQUIRE_MODIFIER_FOR_SHORTCUTS = true; to REQUIRE_MODIFIER_FOR_SHORTCUTS = false; (they still won't trigger if they are disabled as described above)

Don't forget to save the script after you've made a change (Ctrl-S on Windows or ⌘ + S on macOS).

Shortcuts

Two keyboard shortcuts are provided:

  • Ctrl-M or Alt-M will switch between desktop and mobile version. If you are on a mobile Wikipedia page and want to see the desktop article, use this shortcut to switch to the desktop version of the same page.
  • Ctrl-E or Alt-E will switch to the page editor if you wish to contribute to an article. Note that regardless of the version of the site you're on, the desktop editor is loaded since the mobile editor is so limited.

You can also set REQUIRE_MODIFIER_FOR_SHORTCUTS to false in the script to make these shortcuts trigger on M and E without Ctrl or Alt modifiers.

Screenshots

Mobile page, clean and readable:

screenshot of mobile wikipedia

Desktop page, extremely wide and with very long lines that reduce readability:

screenshot of desktop wikipedia