JavaScript Oddity in FireFox

I have a web page that opens another popup page, and now I needed to also have it automatically redirect back to a previous page after it opened the popup.  I thought this would be very easy to do, and it was in IE, but it turned out to not be so easy in FireFox.

This is what I thought would work -- it does in IE, and each of the individual lines works on their own in FireFox, but together in FireFox you don't get a popup:
    window.open('NewPage.aspx');
    document.location = 'PreviousPage.aspx'; // window.location doesn't help, neither does location.href

The following is what turns out to work in both IE and FireFox -- I hope this trivial piece of JavaScript helps someone out there since it took me a few minutes:
    window.open('NewPage.aspx');
    location.replace('PreviousPage.aspx');


11 Comments

Comments have been disabled for this content.