How can I force my desktop browser to never use mobile Wikipedia links (e.g., en.m.wikipedia.org)

9

2

Often in the comments of a website someone will post a mobile Wikipedia link (e.g., https://en.m.wikipedia.org/wiki/Main_Page), presumably because their mobile browser sent them there and they copy-pasted the link.

Is there a browser extension or other solution that will convert the explicit en.m.wikipedia.org mobile link to en.wikipedia.org?


For my use case this specifically applies to Firefox (version 62.0a1 (2018-05-11) (64-bit) at the time of writing). However, I also often use Chrome as well.

Andrew Keeton

Posted 2018-05-13T01:02:06.797

Reputation: 2 341

Answers

9

You may use the Redirector add-on, available on Firefox and Chrome:  

This simple extension allows you to redirect urls using the power of regular expressions.

For example, you can have all mobile Wikipedia urls to open in desktop mode (this is convered in the tutorial below).

For documentation, visit the product home page for a tutorial with this example :

To set up a redirect for mobile Wikipedia urls, enter the following:

From: ^http:\/\/(.*?)\.m\.wikipedia\.org\/(.*) 
To: http://$1.wikipedia.org/$2

As another possibility, you could also use the Firefox add-on Greasemonkey, available on Chrome under the name of Tampermonkey.

You could use this Greasemonkey script which redirects Wikipedia mobile to the desktop version :

// ==UserScript==
// @name        wikipedia_desktop_redirect
// @namespace   https://jspenguin.org/monkey
// @description Redirect mobile wikipedia to desktop version
// @include     http://*.m.wikipedia.org/*
// @include     https://*.m.wikipedia.org/*
// @version     1
// @grant       none
// ==/UserScript==

var m = /^(https?:\/\/.*)\.m(\.wikipedia\.org\/.*)/.exec(location.href);
if (m) location.href = m[1] + m[2];

harrymc

Posted 2018-05-13T01:02:06.797

Reputation: 306 093

1Is it secure? This seem to be some type of JavaScript. May it redirect to malicious website? – Biswapriyo – 2018-05-17T21:00:51.160

Redirector is exactly what I needed, thanks. I changed http to https FYI. – Andrew Keeton – 2018-05-17T21:16:29.383

1@Biswapriyo: Should be quite secure. AFAIK redirection rules can only be modified by the manual interface. – harrymc – 2018-05-18T06:03:31.130

I think the forward-slashes need to be escaped for Redirector, too, don't they? Besides, great extension and idea! – Arch Linux Tux – 2019-07-29T19:10:39.297

0

https://addons.mozilla.org/en-US/firefox/addon/skip-mobile-wikipedia/

Here is a Firefox extension if you don't want to use such a big hammer (Redirector) for such a small nail (just mobile Wikipedia links).

Andrew Keeton

Posted 2018-05-13T01:02:06.797

Reputation: 2 341

-1

Mobile-user-agent extensions will help:

For Firefox: Mobile View Switcher enter image description here

For Chrome: User-Agent Switcher for Chrome

Off-course there are serval others you just have to browse the addon-stores!

Stackcraft_noob

Posted 2018-05-13T01:02:06.797

Reputation: 1 466

This is the opposite of what my question is about. But it has the side effect of I "only" need to click the extension twice to go from en.m.wikipedia.org to en.wikipedia.org. "Only" in the sense that I might as well hand-edit the URL instead. – Andrew Keeton – 2018-05-13T19:19:24.023