Tutorialsplane

Vue.js get Hostname


Native JavaScript location hostname property to get the hostname. Here in this tutorial, we are going to explain how you can get hostname in vue.js. You can also use our online editor to edit and run the code online.


Vue.js get Hostname Example

You can use location.host to get and set the hostname in vue.js-

Example:

<div id="app">
	<p>{{result}}</p>
	<button>Click Me</button>
</div>
 

Try it ยป

Output of above example-