This section describes installing Edgemesh manually. Edgemesh can be installed on any website using this method as long as the Prerequisites are met.
Create a file at the root of your web server called sw.js
. It should be accessible from https://yoursite.com/sw.js. Add the following line:
importScripts('https://static.edgeme.sh/edgemesh-sw.js')
Add the following line as early as possible to the <head>
tag of your index.html
:
<scriptasynctype="text/javascript"src="https://static.edgeme.sh/client.js"onload="window.edgemesh = new Edgemesh()"></script>
You can pass any of the Client Config options to the Edgemesh class constructor:
<scriptasynctype="text/javascript"src="https://static.edgeme.sh/client.js"onload="window.edgemesh = new Edgemesh({swUrl: '/my-sw.js',scope: '/assets'})"><script/>
That's it! If there is an installation issue it will be printed in your browsers javascript console. A common one is forgetting to verify your origin on the Edgemesh Portal.