I’m editing a file (any other html file than the main actually) in this project: https://glitch.com/edit/#!/intro-to-html-css and when the live preview reloads, it always takes me back to the /
Is there a way to get it to load the current file, or do I have to work around it with a script and some localstorage magic?
I figured that’d be the answer, so I wrote a hacky script to work out the navigation.
But glitch could take the current file and if it’s a html file, reload the window to that location. Should be a 1 line change in the code. If glitch is opensource, I could do that.
Unfortunately it’s not that easy, since there is not a one-to-one mapping between html files and pages on a web site. Definitely not a 1-line change in the general case it might be possible for static websites though, so we’ll look into that!
I’d say for the case of a static site (or a set of training examples like mine) the best simple improvement would be to open the current html file when live preview is clicked and then reload the same url instead of / on any change anywhere.
So the end user can decide what to view.
A separate button for live preview of current file would also work.
a big part of the difficulty here is that browsers prevent us from having that much control over what is opened in a new tab/window, for security reasons.
I know all about it. I’m a JavaScript developer and I do browser security too. But it’s a window in the same top level domain and you’re controlling the code there, so you could inject code to communicate over postmessage. On the other hand, I appreciate the fact you don’t.
I think a useful feature could be conjured out of just the ability to override the URL in the window.