Switching location.href and location.replace for desired history