Application reloads to root (/) on every file change

If I add a view or HTML file at public/another-page.html, and I open myglitch.glitch.me/another-page.html, and then I edit an HTML file, Glitch will change my other tag to go back to myglitch.glitch.me/. I’d expect to just do a simple reload to where I currently am at myglitch.glitch.me/another-page.html.

2 Likes

hey ngokevin,

Sadly, this issue is a known browser limitation. The glitch editor window can open a window for you, but without injecting some code into your project, there’s no way the editor can know which page you’re currently at.

The reasons for this make sense from a browser maker perspective: if you go to amazon.com, ideally amazon shouldn’t know what you’re doing on yahoo(!).

We’d love to solve this, hopefully browsers allow our use case for this in the future.

In the meantime, my recommendation is that you disable auto refreshing and manually reload from the page you want after making some changes.

1 Like

Oops, thanks!

Another way for me was just to open a tab manually, rather than hit the Show.

4 Likes

Regarding how to workaround this limitation, how about using some opt-in code that gives Glitch better control over the page?

E.g. I include a link to a Glitch script in my source code, and that allows a deeper integration with the Glitch editor. Would probably open up all sorts of interesting improvements.

1 Like

Hey Kayce, neat idea! I just put together the beginnings of such a thing here: https://glitch.com/edit/#!/glitch-fun-pack

It currently only does one thing: refresh the app on changes, without sending you back to the root URL.

Ideas for other stuff it could do would be awesome!

4 Likes

Whoops I forgot to tag you in the previous comment @kaycebasques. :point_up:

1 Like

@mrdavidjcole gfp seems to work nicely, thanks!

Just some small feedback incase others hit the same problems:

  • The projects api seems to return null for private projects
  • Some of the docs in the apidocs are named wrong (like restartOnChanges is actually restartAppOnChanges and stuff like that)

It’s solved my immediate itch though so thanks very much!

2 Likes

Oh, nice catch on refreshAppOnChanges, @Ryman! Thanks for pointing that out, and for trying gfp :slight_smile:!