Skip to content

Instantly share code, notes, and snippets.

@meilon
Last active November 2, 2022 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meilon/fe0742a5ca64d49cc880 to your computer and use it in GitHub Desktop.
Save meilon/fe0742a5ca64d49cc880 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Microsoft Support in en-us
// @version 0.6
// @description forces loading the english version of Microsoft KB Articles
// @updateURL https://gist.github.com/meilon/fe0742a5ca64d49cc880/raw/MicrosoftKBinEnglish.user.js
// @downloadURL https://gist.github.com/meilon/fe0742a5ca64d49cc880/raw/MicrosoftKBinEnglish.user.js
// @match http*://support.microsoft.com/*/kb/*
// @match http*://support.microsoft.com/*/help/*
// @match http*://support.microsoft.com/*/topic/*
// @match http*://technet.microsoft.com/*/library/*
// @match http*://docs.microsoft.com/*/*
// @match http*://learn.microsoft.com/*/*
// @copyright 2014+, meilon
// ==/UserScript==
var url = document.location.href;
var re = new RegExp("https?\\:\\/\\/(\\w*).microsoft.com\\/([\\w-]*)\\/(.*)");
var matches = re.exec(url);
console.log(url + " is kb:" + matches[1]);
if (url.indexOf("en-us") <= 0 && matches[1].length > 0 && matches[2].length > 0 && matches[3].length > 0) {
var newUrl = "https://" + matches[1] + ".microsoft.com/en-us/" + matches[3];
console.log("Will switch over to: " + newUrl);
document.location.href = newUrl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment