0

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?

0

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.