function ParseURL() local _, url = GetDocInfo() local i, _, host, path = string.find(url, "^(%a+://[^/]+)(.*)$") if i then return host, path end end function UpDir() local host, path = ParseURL() if host == nil then return end path = string.gsub(path, "/%s*$", "") local lastslash = 0 while true do local _,fend = string.find(path, "/", lastslash + 1, true) if fend then lastslash = fend else break end end if lastslash > 0 then NavigateTo(host .. string.sub(path, 1, lastslash), OPEN) else NavigateTo(host .. "/", OPEN) end end function TopDir() local host, path = ParseURL() if host then NavigateTo(host .. "/", OPEN) end end