0

I'm looking for a "beautiful" and the fastest way to get only the web application url (don't want to trim or substring or anything else).

2
  • 4
    Try this : window.location.protocol + "//" + window.location.host Commented Mar 5, 2015 at 13:39
  • Unnie, can you make this an answer so you get your due credit? Commented Jun 11, 2015 at 13:01

1 Answer 1

0

You can use the below code to find WebApp url, this takes care of port number too (if exists)

var WebAppUrl="";
if (location.port)
    {
        WebAppUrl = window.location.protocol + "//" + window.location.host + ":" + location.port;
    }
    else
    {
        WebAppUrl = window.location.protocol + "//" + window.location.host;
    }

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.