Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

283
Views
How to detect text fragments `#:~:text=` with JS?

when a user clicks on a featured snippet in Google search results, the text element is highlighted by a text fragment. The browser address looks like example.com/landing-page#:~:text=Start%20of%20fragment%20an,End%20of%20fragement.

I now want to detect with JavaScript if a user visits the page with a highlighted text.

I already tried window.location.hash and document.URL but the value after # is not part of the result.

Is that possible with pure JS?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!