can i put a java script file on shopify server ?

New Member
10 0 0

i'm a developer.  i want put a java script file in shopify's server which connected my domain, can that be possible ? or what can i do to make them allow me to do this ?

0 Likes
Shopify Partner
105 2 18

Hello,

 

If that java script file is for you online store, you can put it in your theme's assets folder.

0 Likes
New Member
10 0 0
Thank you very much BogdanM,I have been finding the answer for several
days.
This java script file is for my shopify app clients, so is it possible to
put it on shopify's server ?
if impossible,how should i do? ask my clients to put the file in their
theme's assets folder by themselves ?or is there any easy way ?
0 Likes
Shopify Partner
105 2 18

Hi @alexsvderV 

If you are developing a Shopify App, you have two options to deliver a java script to your app's clients store:

1. Using ScriptTags - recommended

2. Saving the js to the client's theme assets using the Asset API.

0 Likes
New Member
10 0 0
Thank you BogdanM , I am very grateful for your answer.
But my IT colleague said these two method both can’t solve the problem below:
I want to develop an app that have the same feautre like the attachment picture ,it seems I have to host some js file on shopify’s server.
if I host these js file on my own server, all my app clients have to accept my domain popped up in the browser notification. I want the domain popped up in the browser is my client’s shopify store domain. So do you think these 2 anwsers can solve this problem? Maybe my IT colleague’s opinion is wrong. If he is right, is there any other ways to achieve this function ?

thank you in advance.




0 Likes
Shopify Partner
105 2 18

Hi

I can't see any image attached to your post.

 

However, if you save the js in the theme's assets folder, it will be hosted on cdn.shopify.com.

ScriptTag feature should work too, as it is designed to load javascript files from external servers into your clients storefront.

 

If you could post more details, like the "browser notification" you are referring to, I might be able to help.

 

Regards

0 Likes
New Member
10 0 0
Hi,BogdanM, seems can’t attach picture in shopify forum.
This is a link : https://gadgetstouse.com/wp-content/uploads/2018/05/Screenshot-2015-10-02-at-17.37.36.png
If you can’t see the link, you can search :google chrome notification in google ,that’s the same thing I want you know.
0 Likes
Shopify Partner
105 2 18

Hi @alexsvderV ,

 

That popup looks like a confirmation popup for allowing push notifications from a site.

You cannot send push notifications to a client without his approval.

The location of the javascript file is irrelevant in this case.

You can find more details here.

0 Likes
Highlighted
New Member
10 0 0
Hi BogdanM, thank you for your patient.

My IT colleague said there is no problem to achieve browser confirmation popup and push notification ,but we must put some js file in shopify's server so that the confirmation popup shows customer's store domain, not our domain. is it neccesary host js on shopify's server ? or there is some other ways to achieve this?
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