Tanya Sakharova
Tanya Sakharova

Reputation: 23

javascript to change language on google,com

all! I have to solve this task , and ask your help:

Use JavaScript to change interface language at https://www.google.com/

Expecting result: — JS-script that changes language of the page when you put it in browser console.

Upvotes: -2

Views: 858

Answers (1)

Laci556
Laci556

Reputation: 162

Google uses a search parameter named hl to change the language of the site, you can set that manually with window.location.search = 'hl=en-US'. Replace en-US with the language code you want to set.

Sites usually guess your language based on different parameters, such as subdomain, query string (like Google), your location, browser language, cookies, localStorage etc. If you open google.com in an incognito window and change the language on the cookie consent modal, you can see the query string change to the selected language.

Upvotes: 1

Related Questions