-
Notifications
You must be signed in to change notification settings - Fork 249
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
Using data-navigo attribute on a website without a server leads to absolute file path beeing used as location #120
Comments
Sorry, what you mean |
I updated my question and again: I'm sorry, that I submitted this issue before writing the content. I am not sure if you will be notified about the update, but now you definitely will. |
When I change the router configuration to var router = new Navigo(null, true, '#');
router.on(/#(.*)/, function (article) {
console.log('Article is: ' + article);
});
router.resolve(); and apply the mentioned fix, then |
@jonasrudolph I'll expose that reading of the URL as a api method. It was before using |
4.7.0 released. The router now contains a public method router.getLinkPath = function (link) {
return link.getAttribute('href');
}; Here's a test case for reference https://github.com/krasimir/navigo/blob/master/test/spec/InBrowser.spec.js#L355-L379 Let me know if it works as expected. |
Wow, that was fast! Thank you really much, Krasimir, for taking the time to resolve this issue! |
Hey :)
I'm really sorry, that the content of this Issue was just 'Hey :)' in a previous version. I accidentally send this request hitting 'Ctrl + Enter' and then left for lunch before I was able to finish writing this Issue.
Context:
I want to use Navigo for an offline website, more precise: A documentation for a tool I'm building. The documentation will be shipped in the code for the tool. So when someone needs help with the tool, one only has to open 'file:///var/users-project/vendor/the-tool/documentation/index.html' in his browser.
Steps to reproduce:
I created the index.html which contains links of the form:
and defined the router like this:
By doing this, I just have to add new article-html-files and links to them, but don't have to touch the router configuration when adding an article to the documentation.
When I now open the page in a browser with the link
file:///var/the-tool/documentation/index.html
and click on theGetting Started
link, the URL will befile:///var/the-tool/documentation/index.html#/var/the-tool/documentation/getting-started
instead of expectedfile:///var/the-tool/documentation/index.html#overview/getting-started
.Also the
article
variable gets the valuegetting-started
instead of expectedoverview/getting-started
.Possible fix
Without having an overview of the inner workings of Navigo. I suggest to change the code from
to
This way the url successfully will be changed to
file:///var/the-tool/documentation/index.html#overview/getting-started
.But, the
article
variable still hasgetting-started
instead of expectedoverview/getting-started
as value. I currently don't know how to fix that.Am I using Navigo incorrectly or is this a valid bug, that (when fixed) would not break any existing code, that uses Navigo?
Thanks :)
The text was updated successfully, but these errors were encountered: