It's not very clear what you mean.

In principle your configure.php file will contain the domain name you gave it when you installed or whatever you have since edited it to.

If you have multiple domains in your hosting account and have pointed more than one to the folder where your Zen Cart is installed, then they will all start your store.

I'm not sure what you mean by having javascript check for this, but since javascript runs in a visitors browser, there's not a lot that it can do about your server configuration.