Home > Blockchain >  One navigation bar for multiple pages without JavaScript
One navigation bar for multiple pages without JavaScript

Time:08-26

I have found many solutions for this question through JavaScript, but I want to be able to have a website that does not require JavaScript so as to be friendly with non-JS web browsers. I am trying to have a navigation bar on multiple websites without needing to change every HTML page whenever I want to make an update. How can I achieve this? Could I load an HTML file without JS?

CodePudding user response:

If you do not want to use javascript, the other option would be to use PHP to include the files on all the pages you would require the navbar. So essentially, you would copy the navbar snippet into a single file, then using PHP methods (require or include), to add the snippets on all other pages. This way, you only need to edit that navbar snippet you copied whenever you need to make a change and it'll take effect on any page you have either required or included. More info on how to use include and require here

  • Related