Vue.js get browser Platform

We can use navigator platform property to get the platform of browser on which it is running. Here in this tutorial, we are going to explain how you can use native JavaScript navigator platform property.You can use our online editor to edit and run the code online.


Vue.js get browser Platform Example

You can get the browser platform simply as below-

Example:

<div id="app">
	<p>{{result}}</p>
	<button @click="myFunction()">Click Me</button>
</div>
<script>
 new Vue({
 el: '#app',
  
  data: {
	  result: ''
  },  
   methods:{
    myFunction: function () {		
	 this.result = "Browser is running on = "+navigator.platform; 		 
	 }
    }
});
</script>    

Try it »

Output of the above example-

Vue.js get browser platform

Advertisements

Add Comment

📖 Read More