How can I get the name of an html page in Javascript? February 9, 2023 by Tarik var path = window.location.pathname; var page = path.split("https://stackoverflow.com/").pop(); console.log( page );