mercredi 24 août 2016

How can I get the URL address from the browser in ReactJS (servers URL)

I can parse are HTTP response of one of the intial calls and save that in the state but there must be another way to get the URL?

I am using the npm 'rest' library and want to specify a different port but I do not know the path on which machine the server will be installed so I need the server's url.

Solution

window.location.hostname

Aucun commentaire:

Enregistrer un commentaire