-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Manual change of hash into the URL doesn't trigger the route in IE11 #1849
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
Comments
In the meantime, I use this workaround: if ('-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style) { // detect it's IE11
window.addEventListener("hashchange", function(event) {
var currentPath = window.location.hash.slice(1);
if (store.state.route.path !== currentPath) {
router.push(currentPath)
}
}, false)
} |
Thanx for the suggestion! |
same problem when using learn from @Aymkdn if (checkIE()) {
window.addEventListener('hashchange', () => {
var currentPath = window.location.hash.slice(1)
if (this.$route.path !== currentPath) {
this.$router.push(currentPath)
}
}, false)
} |
If you use the code from @yuxizhe I think it's added into the |
I think this is related to IE issue #3740423 https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/3740423/ |
I also have something similar happening to me in IE and also in FF but all good in Safari and Chrome. I'm having a problem with router.push not appending the correct locale in the url for example: mydomain.com/en. I have a Store set up in Nuxt and a plugin with my logic. I also have nuxt-i18n module installed: ** My Store Logic **
My Plugins logic with various console logs to output data:
Why would router.push not function like expected after passing in app.i18n.locale after it's been updated/mutated? I also passed into the 2nd and 3rd arguments for router.push to see what's going on:
|
@andrade1379 did you ever figure this out? I'm having a similar issue where somes routes aren't loading on FF or IE but everything else is fine. |
Using the workaround by @Aymkdn I ran into 2 issues. Where to put the code and I had an issue that required me to press the browser back button twice. I used mounted() to add the event handler and changing from .push to .replace fixed the back button issue.
|
I faced the same issue. And also, hashchange didn't trigger when changing url by clicking on url. |
This still happened for me with version vue 2.5.17, vue-router 3.0.1 - I used this code (with minor changes from @yuxizhe and @Aymkdn) in created() - it should work in mounted() too: let app = {
data: function () {
},
methods: {
},
mounted () {
},
created() {
if ('-ms-scroll-limit' in document.documentElement.style
&& '-ms-ime-align' in document.documentElement.style) { // detect it's IE11
window.addEventListener("hashchange", (event) => {
var currentPath = window.location.hash.slice(1);
if (this.$route.path !== currentPath) {
this.$router.push(currentPath)
}
}, false)
}
}
} |
I had the same issue with one of my links - I was using |
Same problem in old version Chrome. I tested in Chrome v52. |
Version
3.0.1
Reproduction link
https://codepen.io/Aymkdn/pen/MENZPx
Steps to reproduce
What is expected?
The component to be loaded based on the current hash into the URL
What is actually happening?
The changes are not detected under IE11. It works with Firefox.
When the page is already opened and I want to copy/paste a link into the same page which has the same url but a different path/hash
The text was updated successfully, but these errors were encountered: