can i put a piece of short java script code on shopify's server ?

New Member
10 0 0

i‘m a  developer, i want put a java script file in shopify's server which connected  app users's domain. can it be possible? or What do I need to do to make shopify allow me to put these files? any answer will be appreciative

0 Likes
Shopify Staff
Shopify Staff
1113 77 153

Hey there, 

 

The ScriptTag resource can be used to load remote javascript onto a shop's storefront, which I think may interest you. However, this resource does not supply the hosting of that javascript code on Shopify. 

0 Likes
Highlighted
New Member
10 0 0
Thank you john , I am very grateful for your answer.
If I can’t host js file on shopify’s server, can I have other ways to develop an app that have the same feautre (pop up my client’s shopify store domain) like the attachment picture ?
(if I host these js file on my own server, all my app clients have to accept my domain pop up in the browser notification. I want the domain popped up in the browser is my client’s shopify store domain, so I need host the js file in shopify’s server )


0 Likes
New Member
10 0 0

in another words, How do i remotely register service-worker.js file when develop this app ?

0 Likes
Shopify Staff
Shopify Staff
1113 77 153

Hey again, 

 

I think that we might be misunderstanding each other. I'd recommend hosting your JS externally and then using the ScriptTag resource to register that JS on any shops that install your app. You could test this on a development store in order to confirm it works as you'd expect.

 

Also open to other community members' solutions to this - I know that creating a theme asset and calling that on the storefront is a viable solution as well, but I think that using a ScriptTag is better since it is automatically removed when an app is uninstalled.

0 Likes