browser read file in current directory code example
Example 1: js get file content from url
fetch("https://URL/file").then((r)=>{r.text().then((d)=>{let CONTENT = d})})
Example 2: js get file location
var url,foldersAndFile,folders,folderpath,protocol,host,ourLocation;
url = window.location;
foldersAndFile = url.pathname.split("/");
folders = foldersAndFile.slice(0,foldersAndFile.length-1);
folderpath = folders.join("/");
protocol = url.protocol+"//";
host = url.host;
ourLocation=protocol+host+folderpath;
return ourLocation;