0

I am redirecting the user using window.location.href.

If I do not switch the & to & joining the URL parameters in the string, IE7 and IE8 complain (for example, the &reg is turned into a registered trademark symbol).

If I just write the & as &, my modern Firefox 24.0 doesn't process the parameters because it just reads them as straight &.

How can I encode the URL in such a way that makes both browsers happy? encodeURIComponent() just breaks the whole thing for everyone.

window.location.href = '/ex/mypage.php?MemberID=' + memberID + '&reg=reg&rid=' + return_data + '&YearRegisteringFor=' + regYear;
7
  • Just a guess: Try using window.location instead Commented Aug 27, 2013 at 14:18
  • @lzkata Just tried it, it did not make a difference. Commented Aug 27, 2013 at 14:21
  • Did you try to post a URI rather than just the path? (i.e. example.com/ex/mypage.php?...) Commented Aug 27, 2013 at 14:30
  • 2
    I would just forfeit and use a different url parameter name. This is a known bug in IE7/8, and the only fix is to use & in place of &, which as you can see, makes it stop working correctly in firefox 24.0. You could use browser detection, or possibly find a way to detect support for using &reg=, however that's far more maintenance heavy than just changing the parameter name. Commented Aug 27, 2013 at 14:36
  • @Sebastian That wouldn't make a difference in this case Commented Aug 27, 2013 at 14:38

1 Answer 1

1

I would just forfeit and use a different url parameter name. This is a known bug in IE7/8, and the only fix is to use & in place of &, which as you can see, makes it stop working correctly in firefox 24.0.

You could use browser detection, or possibly find a way to detect support for using &reg=, however that's far more maintenance heavy than just changing the parameter name.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.