[Bug] OpenURL utility ignores hash when setting relative url
If router is in hash mode and you call openURL with a relative path it sets the path without the"/#" prefix.
Problem: To get the correct path in hash mode you would have to prefix all of your entries with a hardcoded "/#/path". If at a later date you switch to history mode you would need to adjust all of the openURL calls.
Suggested fix:
Pay attention to the vueRouterMode setting in the build config and auto prefix relative urls with the hash as necessary. To make it a non-breaking change I'd also check if its already being passed in.
Thanks!
Can you please create a PR for this?
I could try, never done a PR before :) Not sure how long it will take me to read up on how to proceed...
One issue with me doing this is I do not have a cordova testing environment and don't know how it would affect that section of the open-url.js code. Does cordova even use router hash mode?
@pdanpdan
I've currently worked around the issue for my project but I'd be happy to make the adjustment I've suggested if you want me to proceed.
Before I create a PR, could you tell me if I should include Cordova in the router hash adjustments? I do not have a way to test it nor understand how it uses history.
Thanks
Hi,
Closing this. openURL() is by no means required to keep account of the window's hash location. The main idea is for you to supply a full URL. So do just that. Make use of window.location.hash when you create those URLs.