Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwv37/3b079e6ec8dd34e6f2c7 to your computer and use it in GitHub Desktop.
Save rwv37/3b079e6ec8dd34e6f2c7 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name AmazonSmile Redirect
// @namespace http://jdel.us
// @description Redirect Amazon to AmazonSmile
// @include http://*.amazon.com/*
// @include https://*.amazon.com/*
// @version 0.4
// @grant none
// ==/UserScript==
var url = window.location.host;
if (url.match("smile.amazon") == null) {
url = window.location.href;
if (url.match("//www.") != null){
url = url.replace("//www.", "//smile.");
} else if (url.match("//amazon.") != null){
url = url.replace("//amazon.", "//smile.amazon.");
} else {
return;
}
console.log(url);
window.location.replace(url);
}
@jdelamater99
Copy link

Thanks, I just saw this edit. I tried to merge your changes back into my version, but couldn't figure out how (also new to gist), so I just copy/pasted your code over mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment