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

Add support for search query in URL #658

Merged
merged 2 commits into from Nov 1, 2017

Conversation

2 participants
@ericcornelissen
Copy link
Contributor

ericcornelissen commented Nov 1, 2017

As discussed in #648, implemented JavaScript based support for a search query in the URL. This feature does two things:

  1. If you go to www.simpleicons.org/?q=adobe, the page will load with a search query for the string 'adobe'.
  2. If you start searching on www.simpleicons.org, the url will be updated with each keystroke to www.simpleicons.org/?q=hellowor.

Since window.history.replaceState is being used, this changing of the URL does not mess with the browser history. I.e. if the user came from www.google.com, started searching and press the back button they will return to www.google.com immediately.

Add support for search query in URL
As discussed in #648, implemented JavaScript based support for a search
query in the URL. This feature does two things:
1. If you go to `www.simpleicons.org/?q=adobe`, the page will load with
a search query for the string `'adobe'`.
2. If you start searching on `www.simpleicons.org`, the url will be
updated with each keystroke to `www.simpleicons.org/?q=hellowor`.

Since `window.history.replaceState` is being used, this changing of the
URL does not mess with the browser history. I.e. if the user came from
www.google.com, started searching and press the back button they will
return to www.google.com immediately.
@birjolaxew

This comment has been minimized.

Copy link
Member

birjolaxew commented Nov 1, 2017

URLSearchParams isn't supported by IE, according to MDN. Perhaps we could parse the URL parameters ourselves?

Use custom URL parser for query parameter
As pointed out by @birjolaxew, URLSearchParams isn't supported by IE.
Hence, adding a custom URL parser to get the query parameter.
@ericcornelissen

This comment has been minimized.

Copy link
Contributor Author

ericcornelissen commented Nov 1, 2017

Good point, I updated it using a fallback I found here 👍

@birjolaxew birjolaxew merged commit a63abe4 into simple-icons:develop Nov 1, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@birjolaxew

This comment has been minimized.

Copy link
Member

birjolaxew commented Nov 1, 2017

👍 Looking good! Merged

@ericcornelissen ericcornelissen deleted the ericcornelissen:url-search-query branch Nov 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment