Background:
My current working environment involves many navigation links that constantly updates, but the system admin will not allow PHP (or any dynamic server). This is frustrating.
Question:
Is there a way to implement a class-like structure for HTML using JS to have a makeshift PHP method “include” in my HTML?
Example:
For instance, I really appreciate how in PHP I can modularize the navigation links on the top of my website to a file called navbar.php and then include it to all my separate pages. Once a change has been made to the navbar.php, all the other pages will reflect the changes. Unfortunately, my workflow forces me to update all the webpages in a menial fashion. Is it possible to use JS?
Thanks!
Use a js file that dynamically creates nav bar on page load and place it in all pages, you can also check which page it is using
documnet.locationand highlight and all. One change in this file and all pages changeBut this will be against graceful degradation, if JavaScript is disabled!!! your site is without any main navigation menu.
You will have to find a work around. Create a basic pure html navigation bar, that contains your consistent links.
Include a js file that replaces this with a better bar, like said above.