Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ParkWardRR/61f994800b8861d1abec7f5e152611e7 to your computer and use it in GitHub Desktop.

Select an option

Save ParkWardRR/61f994800b8861d1abec7f5e152611e7 to your computer and use it in GitHub Desktop.
Tampermonkey/Greasemonkey userscript that redirects https://www.ecobee.com/ (site root) to https://www.ecobee.com/consumerportal/index.html using document-start + location.replace to minimize flicker and avoid history pollution.
// ==UserScript==
// @name ecobee homepage -> consumerportal redirect
// @namespace https://gist.github.com/ParkWardRR
// @version 1.2.0
// @description Redirect ecobee.com to the Consumer Portal login (skips /consumerportal/*), early (document-start) with location.replace().
// @author Your Name
// @license MIT
//
// IMPORTANT (Violentmonkey): metadata must be at the very top of the file and formatted exactly. [page:1]
//
// @match https://www.ecobee.com/*
// @match https://ecobee.com/*
// @run-at document-start
// @noframes
// @grant none
// ==/UserScript==
(() => {
'use strict';
const TARGET = 'https://www.ecobee.com/consumerportal/index.html';
// Don’t loop.
if (location.hostname === 'www.ecobee.com' && location.pathname.startsWith('/consumerportal/')) return;
// Redirect anything on ecobee.com -> portal.
location.replace(TARGET + (location.search || ''));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment