📜  js 获取文件位置 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:24.649000             🧑  作者: Mango

代码示例1
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