I have an emulator I wrote for testing smart TV web apps. The emulator itself is a web app, with a simple interface that showing a TV and remote, and loads the web app being tested inside an iframe. Users launch the emulator from the command line, which starts up two simple HTTP servers (one for the emulator, one for the web app being tested), then starts up chrome using the --app command line switch pointing it at my emulator.
The problem is that every time Chrome launches, it loads a cached version of the web app. If you made changes to your web app since last launch, they aren't shown until you do a hard refresh of the page.
To get around this, I've tried the following:
- Launching Chrome with the addition of the --disable-cache switch
- Appending a random query param to the startup URL passed to chrome (ex:
--app=http://localhost:6001/?random={some_hash}
) - Appending a random query param to the web app URL specified in the iframe
None of these seem to do the trick, however. The emulator code doesn't appear to be getting cached as the src URL in the iframe does indeed get a new random value appended to it every time. However, the page loaded in the iframe is old, and always requires an refresh after initial launch.
Any other things I can try that I haven't covered above?
Further example of issue:
- User launches emulator for first time for web app 1
- Web app 1 shown in emulator
- User closes emulator
- User launches emulator for web app 2
- Web app 1 shown in emulator
In this case, the emulator would launch and still show web app 1. It continues to show web app 1 through refreshes until the user performs a hard refresh (cmd+shift+r), at which point web app 2 finally displays.