For some reason when I set window.location.href = it opens another window.
window.location.href = 'https://MyDomain.com/Checkout/Purchase.asp';
It doesn't happen in my development environment, only production. The only only thing different that I can think of is that we are switching from http to https. If this were a straight link () it would work.
Any ideas how to get this to work correctly? The url is built with Javascript (it requires some information from the user).
3 Answers 3
What about specifying the target?
window.open("http://asdf.com", "_self");
Comments
Browsers can be configured to behave many ways, you have no control from javascript if it opens a new window or not. BTW location.href is faster
1 Comment
location.href is faster to type and that's about it. The scope chain resolution savings from removing window is trivial.Have you tried window.location.replace() instead?