Я работал над проектом кодирования, и я пытался иметь несколько «страниц» в одном файле HTML (например, awsomeSauce.com/page.html#videos и показывая только раздел видео), в то же время имея тот же Navbar и до сих пор JavaScript. Есть идеи? < /P>
// Get the current URL (awsomesauce.com/page#videos in this instance)
let url = window.location.href;
// Get the length of the current URL
let urlLength = window.location.href.length;
// Extract the portion of the URL starting from index 21
let = url.substr(21, urlLength);
Подробнее здесь: https://stackoverflow.com/questions/791 ... in-the-url