if removeQuery with window.unload event then browser can't find console. so log code wrapped with try-catch