Vue.js Get Browser User Agent
Navigator userAgent Property is used to get the browser user agent property. Here in this tutorial, we are going to explain how you can get the user-agent header sent by browser.
Vue.js Get Browser User Agent Example
You can get the user-agent in vue.js 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 = "User Agent = "+navigator.userAgent; } } }); </script> |
Output of above example-
Advertisements