Custom

Basic Edgemesh installation instructions applicable to most sites and platforms.

This section describes installing Edgemesh manually. Edgemesh can be installed on any website using this method as long as the Prerequisites are met.

Create Service Worker

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:

sw.js
importScripts('https://static.edgeme.sh/edgemesh-sw.js')

Add Client

Add the following line as early as possible to the <head> tag of your index.html:

index.html
<script
async
type="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:

index.html
<script
async
type="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.