site

source files for beau's website
git clone https://git.beauhilton.com/site.git
Log | Files | Refs

tab-title.js (472B)


      1 var url = window.location.pathname; // gets the pathname of the file
      2 var str = url.substring(url.lastIndexOf('/')+1); // removes everything before the filename
      3 str = str.substring(0, str.length - 5); // removes the extension
      4 var filename = str.replace(/%20/g, " "); // if the filename has multiple words separated by spaces, browsers do not like that and replace each space with a %20. This replace %20 with a space.
      5 document.getElementById("title").innerHTML = filename;