Skip to content

Instantly share code, notes, and snippets.

@AJolly
Last active May 27, 2024 07:30
Show Gist options
  • Save AJolly/35d7693d3baaef2f8ca17cdd015bcead to your computer and use it in GitHub Desktop.
Save AJolly/35d7693d3baaef2f8ca17cdd015bcead to your computer and use it in GitHub Desktop.
Force Google to be US based
// ==UserScript==
// @name ForceGoogleTo English Jolly
// @description Forces google to search in english - jolly
// @namespace http://tampermonkey.net/
// @version 0.1.4
// @author You
// @match https://www.google.com/search?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant none
// @downloadURL https://gist.github.com/AJolly/35d7693d3baaef2f8ca17cdd015bcead/raw/?cache-bust=111
// @updateURL https://gist.github.com/AJolly/35d7693d3baaef2f8ca17cdd015bcead/raw/?cache-bust=111
// ==/UserScript==
//if(window.location.href.indexOf("search?")!=-1 && window.location.search.indexOf("&gl=us")==-1) {
(function() {
'use strict';
if(window.location.href.indexOf("search?")!=-1 && window.location.search.indexOf("&hl=en")==-1) {
console.log("changing google search url for english/us");
var baseURL = window.location.origin + window.location.pathname+window.location.search+"&udm=14&tbs=li:1&lr=lang_en&hl=en&gl=us&cr=countryUS&gws_rd=cr"+window.location.hash;
window.history.pushState({"pageTitle":document.title},"", baseURL);
}
else {
console.log("No change in google search url needed");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment