I wanted to have a custom layout for anyone visitsing my website with text fragment link.
eg. https://en.wikipedia.org/w/index.php?title=Cat&oldid=916388819#:~:text=Claws-,Like%20almost,the%20Felidae%2C,-cats
Here the part after :~: will be the text fragment. I wanted to get that part.
I have tried window.location.href and window.location.hash. But
window.location.href returns just the url without text fragment while window.location.hash returns an empty string.
To replicate this visit this https://en.wikipedia.org/w/index.php?title=Cat&oldid=916388819#:~:text=Claws-,Like%20almost,the%20Felidae%2C,-cats by copying and pasting it to new tab, and try getting the text fragment from window.location (markdown link seems to have problem with text fragment).
So is there any other way to get the text fragment part in address bar ?