I want remove hashtag(#) from urls, but also i need to save no-reload mode. Can i do that?
I have: page.com/#/home
I want: page.com/home
I tried mode: 'history'
, but page reloads with it.
UPD: Is it possible to create SPA app without page reloading and with normal URLs?
With the Hashtag remover all hashtags marked with a number sign (#) in front of a word or unspaced phrase are removed from an entered text. The result will be a normal text without any hashtags, which can be copied and used for other purposes.
Tap the photo or video that you've been tagged in. Tap your name when the tag appears. Confirm by tapping “Remove” (iPhone) or “Yes I'm Sure” (Android).
Instagram app for Android and iPhoneTap or your profile picture in the bottom right to go to your profile. Tap in the top right, then tap Your activity. Tap Recent searches. Tap Clear all, then tap Clear all to confirm.
When activating the history mode, you need to first configure your server according to the documentation. The reason for that is, that the history mode just changes the URL of the current page. When the user actually reloads the page, he'll get a 404
error, because the requested URL is not actually there. Reconfiguring the server to serve always the main index.html
of your SPA resolves this issue.
When using a #
in the URL (no history mode), the browser tries to navigate to the element with the ID, which was given after the #
(within the same document). This was the original behavior of the fragment identifier. Therefore, if you add a link to your HTML with such a fragment identifier, the browser won't reload the page but actually look for the ID inside the document. The vue-router watches this change and routes you to the correct route. This is the reason it works with hashes. If you just add a regular URL to the HTML, the browser's native behavior is to actually navigate to this page (hard-link). This leads to your experienced reload effect.
The way to handle this, is, to never use regular links to route within a Vue Single-Page-Application. Use the tag <router-link>
for routing between one page and another (but only within the SPA). This is the way to go, no matter if the browser allows the navigation with #
without reloading or not. Here is the documentation for the recommended routing tag: link
You can also route from one route to another programmatically. Use $router.push()
for that. Here is the documentation for that: link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With