I have a code which does something if port is xxxx. Here is the code:
function port() {
if (window.location.port === "9876") {
window.location = "http://pc-john.example.com:9877/app/private";
}
else {
window.location = "http://pc-john.example.com:9876/app/private";
}
}
It's working very well. However, I'm stuck with this url which is hardcoded right now.
http://pc-john.example.com:9877/app/private
In this url name can change so I need to do something more felxible, url colud be like this:
http://pc-jack.example.com:9877/app/private
or
http://pc-sara.example.com:9877/app/private
Can anybody help me with this? Thank you all.