I need to include some scripts in to my service worker. Normally we are appending scripts to DOM using document object. But in the case of service workers there is no DOM. So how can we do this using JS codes?
Thanks..
I need to include some scripts in to my service worker. Normally we are appending scripts to DOM using document object. But in the case of service workers there is no DOM. So how can we do this using JS codes?
Thanks..
Use the importScripts function. you can host your js files on an https domain and do something like this:
importScripts("//cdn.jsdelivr.net/pouchdb/5.3.1/pouchdb.min.js");