🛑 This is a backup of the original keep-silk-open on Gitlab for posterity.
⚠️ The Ko-fi links within this readme point to the ORIGINAL AUTHOR. Feel free to support them for their effort. I just wanted to make it clear that I'm not endorsing or encouraging anything. Rather, I just wanted to make sure there was a backup of this code available since it was MIT licensed and Gitlab projects have a history of disappearing. :)
On Amazon Echo Show devices, there currently is only one browser available. The Silk browser.
This browser will always close after some time of inactivity because of how these Amazon Echo Show devices work. This script fights this inactive state so that the browser will stay open.
After the user has interacted with the page at least once (e.g. touch any point on the screen), this script will play a completely silent audio file in the background of your website and will reload it every minute. This way the silk browser will think that it is actively used.
To use this script, your web page must embed this script tag somewhere in the document:
<script defer src="https://dagammla.gitlab.io/keep-silk-open/keep.js">
</script>
This script will only execute on browsers with Silk
in their User Agent. To execute the script on every browser, do the following:
<script>
var AlwaysUseSilk = true
</script>
<script defer src="https://dagammla.gitlab.io/keep-silk-open/keep.js">
</script>
Some people like to use this script to display their Home Assistant dashboard on their Echo Show device. For this you can embed this script into your dashboard via the Webpage/iframe card. Just add a new Webpage card to your dashboard with the following url:
https://dagammla.gitlab.io/keep-silk-open/iframe.html
Personally I could only test this on my Amazon Echo Show 5 2. Gen, but to test whether this will work on your Echo Show, visit this webpage:
https://dagammla.gitlab.io/keep-silk-open/test.html
Usually your browser will timeout after ~10 minutes
For debugging, it can be helpful to visualize the audio element. To do this, write the following:
<script>
var AlwaysUseSilk = true
var SilkVisualMode = true
</script>
<script defer src="https://dagammla.gitlab.io/keep-silk-open/keep.js">
</script>
Sometimes you might want to stay on a web page that is not developed by yourself. For this you need to add a bookmark with the following url:
javascript:(()=>{document.body.appendChild(document.createElement("script")).src='https://dagammla.gitlab.io/keep-silk-open/keep.js';})();
This is only experimental as most web pages will follow a strict Content Security Policy which will prohibit this script from executing.
Please support me on Ko-fi