Reputation: 603
I call my application with a get request and some parameters... I can retrieve them without any problem, but then the application continues with the parameters in the url.
I get this in development mode
myapp?name=...&pass=...
I just need to erase the line: "?name=...&pass=...". Without refreshing my application.
Thanks!
UPDATE: In most browsers, though, there is a new mechanism called pushState so as you can change the url to whatever value without reloading the page. GWT does not have any wrapper for this yet, but you can use it through JSNI or, if you prefer to add gwtquery to your project, using this code:
import static com.google.gwt.query.client.GQuery.*;
Properties history = JsUtils.prop(window, "history");
JsUtils.runJavascriptFunction(history, "pushState", null, null, "whatever.html?foo=true");
Only one problem... dont't works with CHROME!
Upvotes: 0
Views: 1250
Reputation: 2460
You can't clear query parameters with GWT's current (2.5) History API because it's based on fragment IDs (the last part of the URI, following '#'). Predating the HTML5 History API, fragment ID changes were the only programmatic changes to the URI that could be made without reloading your web app.
Taking advantage of the HTML5 History API with your GWT app (in browsers which support it) is currently possible thanks to Johannes Barop's gwt-pushstate library. It is likely to help you with your requirement of removing query params without reloading the app.
Here's a handy page for testing HTML5 History API support.
Upvotes: 1
Reputation: 1701
Use History#newItem(java.lang.String historyToken,boolean issueEvent)
and set your issueEvent to false
Upvotes: 0