Store new location on location change for IE fix.

Refactored the replacedUrl variable to store the new URL on both
location.replace and setting location.href directly to handle delays in
actual location value change in IE.