I'm trying to figure out how to detect when a user navigates from one post to another on Reddit. Since Reddit is a single-page application (SPA), typical event listeners like hashchange or URL change don't seem to work, and using a Mutation Observer causes it to trigger too frequently. Are there any effective alternatives I can use?
2 Answers
Are you developing a browser extension? If so, the History API might just be what you need. Here's a [link](https://stackoverflow.com/questions/4570093/how-to-get-notified-about-changes-of-the-history-via-history-pushstate) that explains how to get notified about changes in history.
One of the most reliable methods is to use the History API override. It can catch programmatic navigation effectively. But I'm curious, what's your main goal with this? Are you looking to implement analytics, content injection, or something different?
Related Questions
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads