Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1188 How can I extract just the filename (e.g. thispage.htm) of the URL currently loaded?

You are here: irt.org | FAQ | JavaScript | Link | Q1188 [ previous next ]

Try:

<script language="JavaScript"><!--
var fileName =
location.pathname.substring(location.pathname.lastIndexOf('/')+1)
alert(fileName);
//--></script>

Feedback on 'Q1188 How can I extract just the filename (e.g. thispage.htm) of the URL currently loaded?'

©2018 Martin Webb