Use redirects for a gracefully navigation

This commit is contained in:
emanuele-f 2016-11-18 17:08:29 +01:00
parent 375458b378
commit d82a4cee6c
2 changed files with 21 additions and 6 deletions

View file

@ -2318,6 +2318,21 @@ print [[
end
function jsRedirect(subpage, withoutTag)
local url = '"'..ntop.getHttpPrefix()..'/lua/'..subpage..'"'
if not withoutTag then print("<script>") end
print[[
if(history.replaceState) {
// use history facility if available
history.replaceState(null, null, ]] print(url) print[[);
} else {
// fallback
window.location.href = ]] print(url) print[[;
}]]
if not withoutTag then print("</script>") end
end
-- ####################################################
-- Compute the difference in seconds between local time and UTC.