Reputation: 1
javascript newb here trying to learn. I have been asked at work by the guy who pushes the pages into the different environments this question "if theres a way of reading the URL domain and putting it in a variable? What I am trying to accomplish is not having to change this approot value on our login pages every time I push from QA to uat or live " I have been looking online for an answer and so far I have come up empty, can anyone here please help me?
Upvotes: 0
Views: 39
Reputation: 943214
Client side? You can read it from the location
object (which will stringify to give you the full URI of the page).
As a rule of thumb, however, it is better to use either relative URIs or to have a deployment script smart enough to know what environment it is deploying to and use the right configuration for each.
Upvotes: 4