Vue.js Detect Browser Language
We can use navigator language property to get the language of the browser. Here in this tutorial, we are going to explain how to detect browser default language in vuejs. You can use our online editor to edit and run the code online.
Vue.js Detect Browser Language Example
navigator.language is used to get the browser language. Here is an example of browser language.
Example:
<p>{{result}}</p> <button @click="myFunction()">Click Me</button> </div> <script> new Vue({ el: '#app', data: { result: '' }, methods:{ myFunction: function () { this.result = "Browser Language = "+navigator.language; } } }); </script> |
Output of above example-
This is read only property.
Advertisements