Search code examples
firefoxinternationalizationdnsgreasemonkeyuserscripts

Write a GreaseMonkey script that reacts to domain strings (for I18N, e.g. cn,en,fr,etc.)


Suppose there is a website that supports multiple languages:

  • cn.mydomain.com or mydomain.com/cn or mydomain.cn
  • en.mydomain.com or mydomain.com/en or mydomain.com
  • fr.mydomain.com or mydomain.com/fr or mydomain.fr

I want to write a GreaseMonkey script that has variables assigned different strings/values according to the address the user is loading the page from. How do you do that? Thanks

EDIT: I realize I can just use JavaScript to get the address. Does GreaseMonkey itself support this kind of function?


Solution

  • Does GreaseMonkey itself support this kind of function?

    No it does not.