Ask HN: How do you search for $string if a webpage “supports” infinite scroll?
For me infinite-scroll is one of the most stupid features of the "modern" web. It just makes the experience worse to crank up some dubious engagement numbers.
And to make it clear: I don't want to search for stuff via $string site:reddit.com via some search engine. Often I really want to search for exact $string on a page, but on something like Reddit that does not work anymore.
[/rant]
EDIT: Thanks for all the answers. And I think I hit a nerve here :) Maybe it makes some frontend developers take a step back and really think if it's really a good idea to implement that "feature".
As suggested you can use old.reddit.com in case of Reddit, but for some pages, there just isn't an option and the worst offenders even hijack your CTRL-F and want you to use their own terrible search.
96 comments
[ 5.3 ms ] story [ 164 ms ] threadScroll down a couple of days/pages/whatever and then use Ctrl+F. It‘s annoying as hell, but that usually works as most pages just add stuff at the bottom and don‘t unload the previous content on top
I still remember my consternation when I first noticed this, and it was because I tried exactly what you had suggested, but a previous match further up the page disappeared upon subsequent CTRL+F-ing.
Solution? Use the website's search form.
(I know -- pagination gives you a URL to a specific page of results. Who cares? When was the last time you deep-linked into a specific index page? Doing so is probably a bad idea, since when new content gets added, the contents of a specific index pagination will change.)
unless you paginate in chronological order rather than reverse chronological. but no one does.
2. Hold down Ctrl + End until a desired amount of pages loads
3. Ctrl + F to find $string
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
It's ie 6 user agent with no support of js, so bye bye infinite scroll.
(And then probably provide those search results on an infinite-scroll page, requiring another search function to search through those search results. It's infinite scroll all the way down.)
Then you want to do some math and realize how amazing visual spreadsheets are.
What I mean is, there's no perfect solution and it all depends on what you're trying to achieve.
- Scroll, scroll, scroll, and then click a link. Now click back. You have lost your place.
- How can anyone link to a section far down?
- Impossible to read or use anything in the footer. I suppose if you install infinite scrolling, you remove the footer. But I have heard a story where they forgot.
Linking to things in the middle of a page was solved in the 90s with the hash part of the URL. Aside from legal terms or privacy policies, I haven't yet seen a site with excessively tall pages that don't have some mechanism (hash part or direct linking an entry) of linking to in-the-middle content.
Most sites with infinite scroll don't have a footer, though I have seen a few. Inspect element works well enough there imo, if you're tech savvy of course.
And then promptly broken again in the mid-00s more or less till now, by way of sub-par client side routing, giving rise to SPAs and breaking back buttons, history management and deep linking all over the place. Things are getting slightly better since the history api came about, but you still see loads of sites with non-existent or broken deep linking, and crappy history management, such as reddit. This is of course because the browser behavior of fragment links, history etc. on static content is well defined, but for dynamic content in most cases have to be considered and implemented in the application logic, and it’s never a priority.
Hands up everyone who’s been in planning sessions for your project and right from the start you’ve considered deep linking and history management! Anyone..? No, ok.
Truth is, in my near 15 years of web dev experience, I’ve never once seen this be part of the requirements, because you kind of just expect it to work. Yet it’s incredibly easy to break, unintentionally even, and three weeks before release it’s usually incredibly difficult to fix because of all the corners we’ve painted ourselves into. So then it becomes a thing you fix after the fact, and spend tons of time tryin to figure out how to wrangle your router or framework or what have you to work it out, but turns out you’ll probably have to rewrite it all. But of course you won’t, because it’s silly, so it just becomes one of those things you paper over where possible and quietly ignore otherwise... sigh
Sorry for the rant.
Sadly, most devs know how to implement an infinite scroll, but lack the skill to implement it properly.
Footer — there should be none on an infinitely-scrolled page, but that depends on the layout.
However, this won't work if the page is using virtualised scrolling (common with React et al. SPA for performance reasons, to avoid huge DOM trees as the page expands). The majority of content that is outside of the visible window will simply be unmounted from the DOM.
I'm not sure what the best-practice for a webapp designer is here? Perhaps intercepting Ctrl+F and displaying a custom search that will do the correct filtering on the back-end and update/retarget the view? Azure DevOps does this but it's still frustrating if your focused element is not within the capture point for the event.
A better practice would be to avoid infinite scroll and better yet to think carefully before using a full-blown SPA for a standard UI. If it's a web page as opposed to a web app, there are certain UX features that every browser supports out of the box and many, many users with keyboards will expect.
Oh god no, the solution is simple stop reimplementing the browser in the browser.
Just think of SPAs vs normal backend templated apps. The SPA can be much faster with poor network connection or when the data needed is large but unpredictable. Then the SPA can really shine, if routing is (re-)implemented well enough.
Stripe does this in their docs and I find it absolutely infuriating.
Please don't ever do that. I know one site that does this and I hate it.
[1] https://www.discourse.org/
Fix: Just add a dummy onkeyup function to the document root and body elements, and set @match rules for whatever sites annoy you. Occasionally you'll also need the more generic event handler function as well.
For what it's worth, if you really need to search e.g. "View" to figure out where the View menu is, the OS-native menu option still works.
Then you download the raw logs and every line has a timestamp so you need to write a shell command just to parse out the actual text you wanted to copy.
2. Alternative: same but with web debugging proxy like Fiddler or Charles.
Yep. For JS-heavy pages with virtual scrolling (i.e. removing from DOM stuff that is out of viewport) there's no better solution.
I can't offer anything besides the fact that I love my mouse which has this free roll toggle button. When I press that I can roll the wheel really fast and long without anything slowing it down.
But it's sad that certain websites force users to such measures.
The is no general solution. Infinite scroll style web apps are implementing their own content view, in essence a web browser inside a web browser. It will never behave as users expect.
IE6 User Agent:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
https://addons.mozilla.org/es/firefox/addon/uaswitcher/
This can be done with Selenium too.
https://stackoverflow.com/questions/29916054/change-user-age...
I presume this is the corresponding Chrome extension: https://chrome.google.com/webstore/detail/old-reddit-redirec...
(When scraping is fragile and you may have to periodically maintain scripts anyway, this is my conclusion after trying to automate a React website using recently-mentioned lib taiko, and finding it to be hit & miss, although it probably speaks more to my inexperience in general.)
Not saying there aren't bad implementations of infinite scroll out there, those do need to die off, but they aren't that common.
A compromise may be a browser option that one can set globally to indicate whether one wants pagination (and how many results per page) or infini-scroll.
I've see web apps with infinite scroll that will capture your Ctrl+F keypress and provides their own in-page text search tool (ex: https://i.imgur.com/BJPDDFw.png) . I don't find it to be as easy/natural to use than the browsers build in text search, but it's better than broken text search.
Also on YouTube when searching for something on my list of liked videos.
If you want to implement infinite scroll at least implement a damn search.
Here's the addon source [0]. I mostly (only) use the addon to style elements with links to sites I know I never want to visit, but it should work for this type of thing. However, the current UI isn't convenient for adding an adhoc rule.
[0] https://github.com/7w0/ssure/blob/4fd34677ad1c3f667ae85b939f...
I cannot tell you how many times I have gone to commerce sites that use infinite scroll - scroll down - click on and look at a product - back button to listing page returns to top of scrolling page making me scroll down again. What a waste of time.