Vue-router: force enable HTML5 history mode in IE9

Created on 19 Feb 2017  ·  5Comments  ·  Source: vuejs/vue-router

Vue.js / vue-router versions

2.1.18 / 2.1.1

Feature request / Question

How do you force enable HTML5 history mode in IE9?

If I use this polyfill https://github.com/devote/HTML5-History-API and do a page refresh on a route, vue-router doesn't fallback to hash mode (This is what I want).
But if I then afterwards click a router-link, it adds a hash to my url. I imagine that if I can somehow force html5 history mode, It'll work just as fine as on a page refresh.

Steps to reproduce

  • initialize the polyfill require("html5-history-api"); (or whichever module system you use).
  • load page on example.com/route.
  • clicking a router-link to example.com/newroute makes my url go to example.com/route#/newroute. I want it to go to example.com/newroute instead.

If anyone have another solution to this problem feel free to comment.
Because of how this app is made hash mode is sadly not an option.

Most helpful comment

@marktheis There is a new option fallback since v2.6.0 .

https://github.com/vuejs/vue-router/releases/tag/v2.6.0

All 5 comments

Please, make sure to read our Contributing Guide. Issues are for bug reports and feature requests only.

We encourage you to ask questions on the forum , Stack Overflow or on gitter and are happy to help you out there. Come back open a new issue if you find out there's a real issue.


You can force the mode with mode: 'history' when creating the Router

mode: 'history' was already set (I forgot to write it).

Made a post on the forum instead.

@marktheis same problem, any idea?

@daggerjames Never figured it out. Luckily the project I'm working on just scrapped IE9 support. You could bump the forum thread and see if anyone have any ideas.

@marktheis There is a new option fallback since v2.6.0 .

https://github.com/vuejs/vue-router/releases/tag/v2.6.0

Was this page helpful?
0 / 5 - 0 ratings