A very common scenario. In the past, PHP's include was used to introduce it. What methods can be used at the front desk to do this?
The libraries currently introduced include jQuery and Webpack
Things that come to mind are:
Send an Ajax request and put the requested page into the container:
$.get("header.html",function(data){
$("#header").html(data);
});
Make the navigation a jQuery component and initialize each page used
`$("#header").initHeader()`
Are my two ideas correct?
What other methods are there?
And what are the commonly used methods?
There should still be a template file. It feels weird to implement it using jq components...
Write nav into public js and initialize it there.
No need to initialize in every page.