javascript - Chrome window not loading content from Infinite Scroll unless the window (tab) is in focus -
javascript - Chrome window not loading content from Infinite Scroll unless the window (tab) is in focus -
i'm writing chrome extension site. site has infinite scroll feature loads additional details in div user scrolls. i'm writing chrome extension can automatically scroll bottom of document , load details user, extension keeps scrolling till no more additional details available. extension works when tab active, when tab or chrome window not active, extension simply scrolls bottom of page , no additional details loaded in div till tab becomes active again.
is there way can forcefulness chrome load additional details when tab inactive ? have tried using window.focus()
or element.focus()
, these not work.
that's because infinite scroll function checks if page has been scrolled way downwards bottom using event listener, and, if so, loads new elements. if tab not active, onscroll
listener not executed, infinitescroll function not load new elements.
if want load more elements have find , phone call function of infinitescroll loads elements, don't need scroll downwards , trigger event listener.
to phone call function you'll need inject code page context. if don't know how it, you'll find this answer useful (thanks xan link).
javascript html google-chrome dom google-chrome-extension
Comments
Post a Comment