Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature discussion: Multiple HTML files and working links #28

Open
tormodvm opened this issue Jan 27, 2018 · 5 comments
Open

Feature discussion: Multiple HTML files and working links #28

tormodvm opened this issue Jan 27, 2018 · 5 comments

Comments

@tormodvm
Copy link
Contributor

tormodvm commented Jan 27, 2018

I didn't know how you'd feel about such a feature, so I thought it would be best to bring it up here. Multiple HTML files is handy for teaching students how websites work.

Multiple HTML files is relatively easy to implement. The trickery comes when trying to make links work to switch between them. I have a working local branch, but it needs polishing before I can make a pull request.

The way I've done it there, is having a new value in state called htmlInView, that is set to whichever html file that was clicked last. I've also added a script in the iframe that catches all links pointing to local files and changes them to parameter/hash values. Then I monitor the location.href of the runtime and change htmlInView if it points to a html file in state.files. It's working, but I don't know if this breaks the purpose of a sandbox or if there's an easier way to do this?

Any thoughts?

@pygy
Copy link
Contributor

pygy commented Jan 27, 2018

Would you want the JS/CSS files to be loaded in all pages?

@tormodvm
Copy link
Contributor Author

Yes, for simplicity. But when using multiple HTML, I think I'll just not make a JS file.
The same CSS in all pages is a lot less problematic.

@porsager
Copy link
Owner

porsager commented Feb 4, 2018

I think this is an interesting idea, and it could be solved quite elegantly if #6 gets implemented. A dropdown to select the active html file could be shown next to the address field if there are more than one .html file..

@tormodvm
Copy link
Contributor Author

tormodvm commented Feb 5, 2018

I don't think #6 should get implemented, as there are a lot of people not using routing. Could be optional though. 🙂

Do you have any suggestions on how to switch pages when overriding local links in the iFrame? I don't think my implementation is very good.

@tormodvm
Copy link
Contributor Author

Is there a safe way to message which page that should be active from inside the iFrame? In my prototype I used an url argument that was picked up in the location variable, but this might mess up some scripts. Is there another way you can think of or is this undoable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants