Userscripts

· 1min · coleaderme

Userscripts

Enhance web experience.

Without 3rd-party Extention

You don't need external script runner extentions for tasks such as simple redirects..

  1. Create a file *.user.js such as: MyScript.user.js
  2. Edit and save
// ==UserScript==
// @name           OldReddit
// @version        1.0
// @namespace      http://example.com
// @description    This script will redirect www.reddit.com to old.reddit.com
// @match          https://www.reddit.com/*
// ==/UserScript==

// some metadata above and actual code below
// OUR ACTUAL CODE
function reddirect(){
  window.location.host = "old.reddit.com";
}
reddirect();

lets breakdown not-so-obvious metadata:
@namespace leave it to 'https://example.com' know more
@match this will match given url pattern and only run this script on those.

  1. Drag-n-drop MyScript.user.js to chrome extentions tab.
info
Info

for more advanced use cases 3rd-party Extentions will be required.

With 3rd-party Extention

Choice of extention: Violentmonkey