You could get the hash with:
new URL(window.location.href).hash
That includes the #
so you can also .slice(1)
to remove it.
You may also want to use decodeURI
to fix the %20
or other URL encoded characters.
This is a Lemmy Community for perchance.org, a platform for sharing and creating random text generators.
Feel free to ask for help, share your generators, and start friendly discussions at your leisure :)
This community is mainly for discussions between those who are building generators. For discussions about using generators, especially the popular AI ones, the community-led Casual Perchance forum is likely a more appropriate venue.
See this post for the Complete Guide to Posting Here on the Community!
1. Please follow the Lemmy.World instance rules.
2. Be kind and friendly.
3. Be thankful to those who try to help you.
4. Only post about stuff related to perchance.
5. Refrain from requesting Prompts for the AI Tools.
text-to-image-plugin
and ai-text-plugin
) e.g. "What is the good prompt for X?", "How to achieve X with Y generator?"6. Search through the Community Before Posting.
You could get the hash with:
new URL(window.location.href).hash
That includes the #
so you can also .slice(1)
to remove it.
You may also want to use decodeURI
to fix the %20
or other URL encoded characters.
Okay cool. I know you can use window.location.hash in JS, I just don't know what parts are accessible to generators and what's locked off is all. :D
Main thing is, making the has work in the first place.