Hi All,
If, as here at work, we have test, staging and production environments, such as:
http://staging.my-happy-work.com
I am writing some javascript that will redirect the browser to a url such as:
http://[environment].my-happy-work.com/my-happy-video
I need to be able to determine the current environment that we are in.
There is the possibility that I will currently be at a url such as:
http://[environment].my-happy-work.com/my-happy-path/my-happy-resource
I want to be able to grab the window.location but strip it of everything but:
http://[environment].my-happy-work.com
And then append to that string + "/" + "my-happy-video".
I am not skilled with regex, but I suppose there would be a way to parse the window.location up to the ".com"
Thoughts? Thanks!