Skip to content
← Back to Community
HTML
Profile icon
mroumani

I am asking my students to create a multipage website. However, when they add a file and name it page2.html and run it, the code doesn't appear. Only the index.html code appears.
If we try including an internal link to the second page, it will run correctly.
How do we get it so that if we have the code for page 2 is displayed and we click run, we can see it work?

Voters
Profile icon
SantosBunge
Profile icon
JuliaWojcicka
Profile icon
LIVIAGERMANIAGE
Profile icon
iamawesome10901
Profile icon
castiyeaux
Profile icon
DarthWillie16
Profile icon
KhaiDuy1
Profile icon
Luke25
Profile icon
ChristianThone
Profile icon
mroumani
Comments
hotnewtop
Profile icon
LynnOng

Use an anchor Click Here
Or use Javascript

Make sure both HTML files are in the same folder.

Profile icon
golfextre

@LynnOng Thanks for sharing google groups

Profile icon
matthewlarrubia

Just spent 2 hours with the help of a student creating links on the index.html to other pages... REPLIT PLEASE FIND A SOLUTION

Profile icon
AnthonyMouse

The Answer

**You can put the code of page2.html in index.html and it will show. **

Profile icon
themaka

I'm not sure I understand what you're trying to do. Could you share a repl with an example?

Profile icon
AllAwesome497

@themaka I believe what he/she is saying is that she wants to be able to see the second page (in the repl terminal) by only running the website on the file he/she wants displayed
Edit: So like if i have an index and a page2 file, I could click in then page2 file (like i'm going to edit it) then when i hit run in that file it will show that page in the terminal. This way he/she
can avoid redirecting/ clicking and extra link
Just to be extra clear, sure i didn't need the extra explanation lol.

Profile icon
themaka

Is @AllAwesome497 correct, @mroumani ? I'm still not sure I understand.

Is this a second html page that's gets rendered? You want it to render this page instead of the index.html page when you "run" the repl but you don't want the student to create a link to the 2nd page?

Profile icon
Luke25

Tried working with html as well, not sure why it might not work but like TheDrone7 said it might not be supported currently, repl feedback could be useful to help them learn more about it though!

Profile icon
TheDrone7

repl.it currently does not support changing which page is run, you could try this maybe:
Make your students make a list of links to different pages on index.html, so you can easily change which page you want to view. And also make them do their assignment on custom-named files, this way, it will be both organized and easy.

Profile icon
AllAwesome497

Ok make either a link to it on the main page or redirect it. It will always start on main page, but if u open it in a new tab and go to the second page u can just refresh to see it updated (once u run it).

Profile icon
mroumani

@AllAwesome497
Thank you! I created a link and when it opens, I can change page2, and if I refresh the tab, anything I change shows up.
So, is there no way to see the second page run inside of repl.it?

Profile icon
abc3354

@mroumani Hi
I do not think you have a way to do that appart using the "meta refresh" redirection.
You can submit this idea to replit feedback or upvote it if you find it.

EDIT: I tried it here
EDIT2: @AllAwesome497 method is better.

Profile icon
AllAwesome497

@mroumani Yes. Using a little bit of js... window.location.href="<pageName>" it will redirect to the other page upon opening it, Although u won't be able to open that page with the script on it bc soon as u open it it will go to the other (until u remove it, of course). This will also slow down the time for it to run a little bit though.

Profile icon
ChristianThone

@mroumani There is if you look beside the Page URL in the Output there will be what looks like a sqaure with an arrow pointing out of it, it is right next to the pencil:

This file cannot be displayed: https://storage.googleapis.com/replit/images/1551296497098_eac35d47c88ba9f9c207ab362496cc47.pn

Click that and it will pop the webpage into a new tab.

Profile icon
Cerberus_75

yeah you can do what @christianthone suggested and then in the URL bar you can add /page2 which is your file address for replit