HTML apps are rendered by the player using a Web browser (WebKit or Chromium). Running a browser usually requires a great amount of system resources (usually RAM memory). This means that if you use multiple HTML apps the system might run out of memory and performance will be affected.

There are some types of apps though, that are not really required to keep running on a Web browser after they have initially been rendered. These apps are usually the ones whose content will not change or change rarely. 

Some examples are:

  • A rich text app (static, the text and formatting will not change)
  • Shape apps(static, the shape and its properties will not change)
  • A date app(semi-static, the date changes once per day)
  • A weather app(semi-static, update every few hours)

As an optimization for these kinds of apps, we provide a mechanism that allows apps to instruct the player to capture a snapshot after they have finished rendering their content. Once a snapshot has been captured, the system will render it using our resource-efficient image player, instead of a full-fledged, resource-hungry browser.

Taking advantage of this mechanism is quite simple. The idea is that once your app has finished rendering, it should change the window title to notify the player that it can get a snapshot of the app.

When your app is ready for the player to get a snapshot, change the window title as seen below:

document.title = '{"ready_for_cache": true}'