0


I have a webapp, and i'm 99% sure what the next page is that the user is going to visit. This page has to get a lot of data from API's and also has to render it. Since this takes some time I would like to prefetch/preload the page.
I did some research and read this article. The prerender tag does exactly what I want.

Sadly it isn't supported on the stock android browser.browser support for prerender tag

Since i'll be making a android app out of it, it has to be supported. I was wondering if there is a JS framework or maybe something like CrossWalk-project. That can do this.

Nathan
  • 900
  • 2
  • 10
  • 28
  • just and FYI usually when there is a lot of data to fetch is a sign of poor design. I say usually...there are edge cases.. but every time i have seen this... it is due to poor execution. I.e. maybe its not the data that is taking long but the work done and usually its because it was written poorly... I.e i have taken functions that take over 9 secs to 0.2 secs... data size says the same. – Seabizkit Jan 29 '16 at 13:50

1 Answers1

1

On the server side, render the page and flush the response. Then load the data and put it into the session. You can do that in a background thread (don't forget the necessary synchronization) or you can keep the current request open until you're done. The user might see a "still loading" animation in the browser but the current page will be complete, so it shouldn't bother them too much.

If the next page loads, look into the session. If the data is already there, use it. If not, user has to wait.

That said, you should also check your data model and your database indexes and queries. Often, you can bring their execution time down dramatically by adding more indexes or optimizing SQL queries.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820