Live data from Hacker News

Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

news.ycombinator.com

81–90 of 97 posts

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#81
post #39

Infinite scroll is one of those things that needs to die.

Nope, I love infinite scroll as a user. I even use extensions to add it to paginated websites. I wish those websites had infinite scroll as default or as an option cause infinite scroll extensions can be jankey.

Not saying there aren't bad implementations of infinite scroll out there, those do need to die off, but they aren't that common.

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#82
Seems like there’s opportunity for an extension to grab all text as it appears, store in client side DB, search that. I am going to build that as a feature in an extension I am working on to track all of my upvotes as automated bookmarks.

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#84

I see lots of replies suggesting scrolling for a long time and then using CTRL+F. 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? P…

> Perhaps intercepting Ctrl+F Please don't ever do that. I know one site that does this and I hate it.

It shouldn't be possible. That the browsers allow it is the real problem. Same with forced unmounting of resources from the DOM.

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#86

I cannot think of one single use case where infinite scroll makes sense compared to plain old data tables that are paginated with server side search/pagination built in.

Great for if you want your users to forget about how long they are spending on your site. Less friction and no jarring page loads, just a steady drip of dopamine.

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#87

You can paste something like this into your javascript console: setInterval(function() { window.scrollTo(0, document.body.scrollHeight); }, 2000); That will scroll continuously, so you can let it run for a while and then do ctrl-F. It might take a while but you can do something else. I've used it successfully many times (usually when I wanted to scrape the DOM for some reason or another, rather than just do a search)…

Or just put something heavy on your keyboard's "End" key :)

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#88
post #72
post #61

Earlier quoted context omitted.

Discourse [1], popular forum software, does this as well. [1] https://www.discourse.org/

This is infuriating. Every time I CTRL+F on Discourse I get upset.

At one point I had a user script that prevented certain key combinations from being intercepted. Worse than discourse is a hosting platform I was encountering frequently for a while, where pressing esc to stop the page from loading instead caused the website to switch pages to a login prompt for the site owner. Other offenders that annoy me include intercepting alt+d (focus address bar), Ctrl+n (new window, outlook captures this), Ctrl+t (new tab), Ctrl+a (select all), and other common keyboard functions.

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.

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#89

Earlier quoted context omitted.

I agree with this. I feel like infinite scroll gets a bad rap. Pagination is no better. There are some sites and use cases where infinite scroll is a huge usability improvement. (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…

> 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.

It's easy enough. Just request the next X results after the last result on the current page, like so: `?resultsperpage=50&resultsafter=postid750`. If you're not sorting by time, then you should be able to add a time constraint to the search backend and include that parameter as well. I've also seen forums that cache the results for a certain amount of time, and only return the search ID and page number in the query string.

Re: Ask HN: How do you search for $string if a webpage “supports” infinite scroll?

#90

Earlier quoted context omitted.

> Perhaps intercepting Ctrl+F Please don't ever do that. I know one site that does this and I hate it.

Google Docs does this, e.g. in a spreadsheet. I think it's reasonable in that context. 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.

For applications that's fine. I'm mostly refering to traditional websites/forums that should never do this.
Post reply on HN