Tutorial Current Page with JavaScript

This is like a replacement for PHP's SCRIPT_NAME with JavaScript. location.href.split('/').pop(); For example with this URL: htt...

This is like a replacement for PHP's SCRIPT_NAME with JavaScript.
location.href.split('/').pop();
For example with this URL:
http://css-tricks.com/examples/ScriptName/index.php
This code:
document.write( location.href.split('/').pop() );
Would write to the page: "index.php"

Reference URL

Hot in Week

Popular

Archive

item