fixing the function for browsers without Navigation Timing API