Hi there, I am using shopify script tag to add some functionality to merchant store, so in script tag .js file I am trying to register a service worker but I got the following error:
Show More
Uncaught (in promise) DOMException: Failed to register a ServiceWorker: The origin of the provided scriptURL (‘https://fea3-5-219-49-37.ngrok.io’) does not match the current origin (‘https://pouyas-store.myshopify.com’)
here is my code in embeded javascript file:
const baseURL = "https://fea3-5-219-49-37.ngrok.io";
(function (){
navigator.serviceWorker.register(baseURL+"/static/shopify_app/ServiceWorker.js")
.then((reg) => {
console.log("reg",reg);
if (Notification.permission === "granted") {
getSubscription(reg);
} else if (Notification.permission === "blocked") {
} else {
$("#GiveAccess").show();
$("#PromptForAccessBtn").click(() => requestNotificationAccess(reg));
}
});
})()