I've got an app that receives urls after the # sign and responds to them with a History ValueChangeHandler
. Serious problem: the urls are escaped differently on different browsers.
For exampl开发者_Go百科e, when I go to #riley%2Blark%40gmail.com, Chrome sends my ValueChangeHandler riley%2Blark%40gmail.com
while FireFox sends riley+lark@gmail.com
. This is a terrible difference if I want to run URL.decodeQueryString
on them because I'll end up with an extra space in Firefox.
How can I handle this, short of writing separate implementations for different browsers?
I can think of two possible solutions:
U could try adding another parameter to the token so that the token was of the for
#riley%2Blark%40gmail.com/%2B-a-space
on receiving the token, check the second part of the token. If the second part contains a %2B, urldecode the token. else replace '+' withYou can also try using
Location.hash
through JSNI. I reckon the results ought to be uniform.
精彩评论