Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Link | Q1188 [ previous next ]

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

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.