Multi-Page HTML Repls Throwing Errors

Problem description:
When creating a site with multiple HTML pages (and multiple JavaScript files), the web-view inside Replit is throwing errors about variables already being declared. The problem is that the webview is not destroying previously declared variables in time before it loads the next JavaScript file, making it look like variables are already in existence. An audio-free YouTube video of the problem in action can be found here.

The problem does not happen outside of the Replit preview window. It does not happen if you “pop-out” the project into a normal browser tab and view the console.

Expected behavior:
No errors occur. The expected behaviour happens if you view the site and console outside of the Replit web preview. In a normal browser window, everything is fine.

Actual behavior:
See description, above and this YouTube video I made of the problem.

Steps to reproduce:
Go to this Repl (also linked below) for an example. Run it, stay inside Replit and open the console. Click the hyperlinks to go between pages and watch for the error in the console - it may or may not show up.

Bug appears at this link:
https://replit.com/@MrBrash/Multi-Page-Repl

Browser/OS/Device:
Chrome browser on any OS [Desktop]

2 Likes

Great spot @MrBrash I can replicate this error easily (especially with your HTML guide!). It also shows error for creating i variable at times.

I just spent a week researching the same issue and I know what your bug is! You cannot use numbers in the file name of a html file. Change page2 to pagetwo and I’ll bet you’re all good!

You can use numbers in HTML file names.

I can’t reproduce this bug anymore, most likely because we changed the logic here. So looks like we’re all set. Let me know if you guys see otherwise.

That is interesting. I’m a teacher and have about 30 groups of kids doing sites…and only the three who used a number in their html file name are getting errors. Then, when we eliminate the numbers, it works fine.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.