Open GoogleCodeExporter opened 9 years ago
After more tests with parameter values that contain some URLs, I discovered
this code does not work with Firefox.
The comment in the Mozilla permutation indicates that no decoding is necessary
because Firefox already decodes it. In fact, it's not absolutely right. Firefox
decodes but not with the same decoding algorithm. While other browsers use
decodeURIComponent() Javascript function, Firefox seems to decode with
decodeURI().
I reached to fix the problem with URL in parameters with the following code:
/**
* Firefox does not decode history like the other browsers. It uses
* decodeURI() Javascript function whereas other browsers use
* decodeURIComponent().
*/
private String decodeTokenAsHistoryDecodesToken(String historyToken)
{
if (Navigator.getUserAgent().contains("Firefox/")) {
return URL.decodeQueryString(historyToken);
}
return URL.decode(historyToken.replace("%23", "#"));
}
My decodedNewVersion variable is assigned to this method return.
I did not use differed binding to get a different behavior with browsers but it
would be a good practice.
But I believe this fix is a workaround for GWT's History.getToken() method that
does not have the same behavior on browsers.
Original comment by benoit.sautel@gmail.com
on 27 Sep 2012 at 9:59
Original comment by goudreau...@gmail.com
on 27 Nov 2012 at 2:36
Original issue reported on code.google.com by
benoit.sautel@gmail.com
on 26 Sep 2012 at 8:57