Answers for "javascript get current filename"

2

javascript get filename from url

var filename = url.split('/').pop();
Posted by: Guest on February-14-2021
1

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;// http://google.com/search
Posted by: Guest on October-20-2020

Code answers related to "javascript get current filename"

Code answers related to "Javascript"

Browse Popular Code Answers by Language