-
Notifications
You must be signed in to change notification settings - Fork 104
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
How to get an unqualified url? #78
Comments
I'm not sure I understand. If you use a relative URL, isn't the whole URL what you are looking for? let url;
if (parsed.origin === 'null') {
url = parsed.href;
} else {
url = parsed.href.slice(parsed.origin.length);
} |
Yes. But it's prone to error if I have to put that if statement everything. People who are unfamiliar with this library will see |
You can use a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I have a url like
https://www.example.com/abc?q=10#hello
then I can useparsed.href.slice(parsed.origin.length)
to get just/abc?q=10#hello
. However, this doesnt work if I create parsed using the unqualified url because origin will be "null".I see another discussion going on about "null" but regardless, I think it would be nice if there was a convenient way of getting an unqualified url using this library.
The text was updated successfully, but these errors were encountered: