0

This question already has an answer here:

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).

marked as duplicate by Benny Skogberg Jul 14 '16 at 10:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Try this : window.location.protocol + "//" + window.location.host – Unnie Mar 5 '15 at 13:39
  • Unnie, can you make this an answer so you get your due credit? – Eric Alexander Jun 11 '15 at 13:01
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;
    }

Not the answer you're looking for? Browse other questions tagged or ask your own question.