Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Javascript string manipulation


rpking - 12:19 pm on Feb 16, 2001 (gmt 0)


A bit of Javascript I'm writing requires the filename of the page it will be executed on. Is there a simple way to get just the filename?

I can use:

unescape(window.location.pathname)

to give me the complete path but instead of:

[domain.com...]

my code needs just:

filename.htm.

I've looked for a similar command to return the filename, but so far been unsuccessful.

I really hope that there is a simpler way to do this than searching for slashes and chopping up strings etc.


Thread source:: http://www.webmasterworld.com/javascript/178.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com