Prevent caching on Chromecast receiver app

This article intends to assist on enabling and disabling cache on a Google cast custom receiver application.

During development, we don’t want the Chrome cast dongle to cache our receiver app because during this phase we are constantly making changes and we want those changes to immediately reflect on the Chrome cast session for testing purpose.

Thankfully, HTML5 addresses this annoyance with the ApplicationCache interface.

The application cache (or AppCache) allows you to specify which files Chrome cast should cache. Your receiver app will load and work correctly, the changes you made will be reflected instantly for the new session.

The first thing to do is to make a cache manifest file called “cache.appcache” on your root folder.

cache.appcache

CACHE MANIFEST
# v1 2014-11-20

CACHE:

NETWORK:
*

This file should be referenced on your index.html:

<html lang="en" manifest="cache.appcache">

 

Under the CACHE section, you will want to list the files that you want to be cached. In my case, it’s empty. But if I wanted to have some images cached, I would include them:

cache.appcache

CACHE MANIFEST
# v1 2014-11-20

CACHE:
images/logo.svg
images/background.jpg

NETWORK:
*

Read more about using the application cache on the Mozilla Developer Network website.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s