Skip to content

Routing doesn't work with IE 11 : URL change, back and forward buttons #1985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Krabi opened this issue Jan 12, 2018 · 2 comments
Closed

Routing doesn't work with IE 11 : URL change, back and forward buttons #1985

Krabi opened this issue Jan 12, 2018 · 2 comments

Comments

@Krabi
Copy link

Krabi commented Jan 12, 2018

Version

3.0.1

Reproduction link

http://cant-be-created

Steps to reproduce

  1. Create project with : vue init webpack vuejs-webpack

  2. Add some router components in src/router/index.js as:
    ...
    import HelloWorld from '@/components/HelloWorld'
    import HelloWorld2 from '@/components/HelloWorld2'
    ...
    {
    path: '/',
    name: 'HelloWorld',
    component: HelloWorld
    },
    {
    path: '/example2',
    name: 'HelloWorld2',
    component: HelloWorld2
    }

  3. Copy component in src/components/HelloWorld.vue into new src/components/HelloWorld2.vue

Change names and a content a bit.

  1. Add devDependencies (Currenlty this is not clear for me) into package.json:
    "babel-polyfill": "^6.26.0",
    "es6-promise": "^4.2.2",
    "babel-preset-es2015": "^6.24.1",

  2. .babelrs change as:
    ...
    "stage-2",
    "es2015"
    ...

  3. src/main.js as:
    import Vue from 'vue'
    import App from './App'
    import router from './router'

import es6Promise from 'es6-promise'
es6Promise.polyfill()
...

  1. build/webpack.base.conf as:
    ...
    const babelPolyFill = require("babel-polyfill")
    ...
    entry: ["babel-polyfill", "./src/main.js"],
    ...

  2. npm install && npm run build && npm run dev

  3. Open IE 11 and copy paste to URL bar http://localhost:8080/#/

  4. Append into url: example2 and hit enter

  5. NB!!! Nothing happens. Old page is visible. Should show second page content.

  6. Click IE refresh: site is now visible

  7. NB!!! Click back button: nothing happens. Second page is visible.

  8. Click IE refresh: first page is now visible.

  9. FF for example works fine with same solution.

What is expected?

Url hash (#) part shpould change compponents for hash.

What is actually happening?

Nothing happens on url change IN IE. FF for example works fine.

@Krabi
Copy link
Author

Krabi commented Jan 12, 2018

Also same with simplest code:

<!DOCTYPE html>
<html>
    <head>
        <title>VueJS simplest</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="IE=11; IE=edge;" />
    </head>
    <body>
        <div id="app">
            <router-view></router-view>
        </div>
        <script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
        <script src="https://unpkg.com/[email protected]/dist/vue-router.js"></script>
        <script>
            var root, foo, bar, routes, router, app;
            root = {template: '<div>root</div>'};
            foo = {template: '<div>foo</div>'};
            bar = {template: '<div>bar</div>'};
            routes = [
                {path: '/', component: root},
                {path: '/foo', component: foo},
                {path: '/bar', component: bar},
                {path: '*', redirect: '/'}
            ];
            router = new VueRouter({
                routes: routes
            });
            app = new Vue({router: router}).$mount('#app');
        </script>
    </body>
</html>

@posva
Copy link
Member

posva commented Jan 12, 2018

Duplicate of #1849

@posva posva marked this as a duplicate of #1849 Jan 12, 2018
@posva posva closed this as completed Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants