VueJS - Vue Router History

Looking at some of the examples we have of the Vue router you'll notice that the browser is automatically add a hash to the end of the URL. This is the default behaviour for Vue router and it does this so that the browser will not try to reload the page when the URL changes. You can change this behaviour to use the History API added in HTML5 by adding a property to the VueRouter to make it use history mode instead.

const router = new VueRouter({
  mode: 'history',
  routes: [...]

When Vue Router is in this mode it will no longer add the hash to the URL and your URLs will look like any normal application.


Reliable uptime monitoring and instant alerts for any website downtime.

Get 50% off forever using the code 50OFFUP.