My Glitch Button Disappeared!

After setting up a new project ( and editing it a bit, my glitch button just… disappeared. Checking the console shows something about cors:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS request did not succeed).
Error: “Network Error”
exports button[dot]glitch[dot]me/button.js:3
onerror button[dot]glitch[dot]me/button.js:3

The weird part is that if I copy and paste all my code into a new project, it works perfectly! Does anyone know what the issue is?

I accidentally made the project private. Changing that back fixed it haha

@support_staff, does the fact that whether a project is private or not determine the appearance of the Glitch Button?

It seems that (on Firefox, at least) a CORS error is returned when the server doesn’t respond to a request, which is what I assume happened here.

Yes! Changing a project to private disables the Glitch Button. This is stated in red text when visiting the website it calls for, @

It will also not work for custom domains. Only public Glitch subdomains.

1 Like

Correct! See, the button project calls on our API for project info (see the code!/button?path=src/button.js:111:0) and that only works for public projects. I also look for the project name from the URL, which is why the button doesn’t work for custom domains.

1 Like

Couldn’t you find a way to link this with custom domains however? Since technically Glitch did give the project it’s custom domain code and Glitch still controls what is being outputted? Perhaps with a file that is hidden from the Glitch project, but can be accessed when searching for if to make the Glitch button visible?

~button is a Glitch app itself, so it only knows what the app it’s embedded in tells it - essentially, the URL and any content on the page (we don’t add scripts to your apps! if so we could have it spit out more container info). The URL is the most consistent and predictable part of a Glitch app, so that’s where I get the project name from.

I know this is severely offtopic (and probably belongs in Feature Request) but I am mildly interested, why couldn’t you make the Glitch Button more customizable and allow the author to set extra data to it, directly pointing to the glitch project itself? Like in the Glitch Button code, allow the user to pass the name of the Glitch project. If it’s a Glitch subdomain then automatically set it to the current project’s URL. If it passed a private Glitch project, just ignore the request. Like I do understand that you could, as a web developer, manage to add your own Glitch Button by just replicating the current one, but the ease of access would be feasible.

But with one feature, comes one issue. This would let people misdirect people to different Glitch projects, but technically this is already and has been always possible, so who would actually do that?

I could do that, but honestly rn most people don’t use custom domains, so I don’t want to complicate the button embed process for a larger group that doesn’t need it (it would mean updating the editor ui with the new directions which is beyond what I can do within the ~button app). But, yeah, I would love to know more about what you’d like to see in the button and how you’d use it in Feature Requests!

Possibly a way for it to work on custom domains is that an API endpoint on the Glitch API site ( which when called checks through a database of custom domains linked to a Glitch project and if a project was found the API would reply with “Hey there! The domain is linked to the project “blah”!”

(i am aware this would only work for domains linked directly within the editor)

But that only works for custom domains configured through the built-in ‘Add Custom Domain’ feature and domains configured the hard way through does not show up in the the database.

And @jenn, if there is a Glitch API endpoint for that, please let me know!

@charliea21, I just found how to get a Glitch project by domain using the Glitch API: projects/by/domain?domain=project-name!

P.S. Thanks, @beaufortfrancois!