Run different functions depending on domain

Is it possible to have one file, which behaves differently depending on which url it is displayed on?

e.g.

var urlString:String;

urlString = getURL???

switch (urlString)
{
case url1.com:
doThis();
break;
case url2.com:
doThat();
break;
}