Created
February 2, 2023 14:30
-
-
Save shanewholloway/fcfb10272f24bb352d3dc9544c217148 to your computer and use it in GitHub Desktop.
Search a page using text-fragment in the URL hash.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://web.dev/text-fragments/ | |
// location.hash = searchFragment('text to find in page') | |
export const searchFragment = txt => `#:~:text=${encodeURI(txt)}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment