制作ブログ Web制作マークアップJavaScriptファイル名を拡張子なしで取得するサンプル

ファイル名を拡張子なしで取得するサンプル

変数bnにhtmlファイルのファイル名を拡張子なしで取得するサンプル

var bn = location.href.split(“/”);
bn = bn[bn.length -1].split(“.html”)[0];
// https://simplesimples.com/markup/js/basename_js.html の場合
//