Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  175] [ 6]  / answers: 1 / hits: 145768  / 11 Years ago, fri, may 17, 2013, 12:00:00

I have an html page and I would like inside the html page to retrieve the name of the html document via Javascript. Is that possible?


e.g. name of html document = "indexOLD.html"


More From » html

 Answers
16
var path = window.location.pathname;
var page = path.split(/).pop();
console.log( page );

[#78161] Thursday, May 16, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dallasb

Total Points: 657
Total Questions: 98
Total Answers: 97

Location: Luxembourg
Member since Tue, Jan 25, 2022
2 Years ago
;