0

I am using the GWT Hyperlink for click handling. I set the history token to empty string and i am adding a click handler to the hyperlink. Later I realised though when i am clicking on the hyperlink, it is changing the browser url after the ...#.

Is it possible to prevent a gwt hyperlink from changing the browser url?

Noor
  • 19,638
  • 38
  • 136
  • 254
  • Possible duplicate of [this question](http://stackoverflow.com/questions/825712/gwt-how-to-suppress-hyperlink-so-that-it-doesnt-change-my-history-token). [One of the answers](http://stackoverflow.com/questions/825712/gwt-how-to-suppress-hyperlink-so-that-it-doesnt-change-my-history-token/2037479#2037479) suggests using `Anchor` instead of `Hyperlink`. You should try this. – Piotr Dec 28 '10 at 13:52

2 Answers2

0

This is hyperlink as you said. So this is for URL changes but you could set History token to empty string after each page loaded, Hyperlink changes to URL but your page changes it immediately to "..#".

I think you try to do this with clickhandler, maybe your clickhandler run before URL changed.

In this scenario you will meet your previous issue described in post; GWT History Problem

Community
  • 1
  • 1
Yusuf K.
  • 4,195
  • 1
  • 33
  • 69
  • Ya, now I understand, But I am using the gwt hyperlink for a clickhandler and I don't want the url to change when I click on it. Is that possible!! – Noor Dec 28 '10 at 10:58
  • You can give "#" for URL(So URL not changes) and do your works within clickhandler. You could create new panels and replace target URL content in it. – Yusuf K. Dec 28 '10 at 11:16
  • I have tried placing '#' only but this leads to http://127.0.0.1:8888/BiddingSystem.html?gwt.codesvr=127.0.0.1:9997#%23 – Noor Dec 28 '10 at 12:06
  • You could also try just using a `Label` with a click handler that calls `History.newItem()`. – Jason Hall Dec 28 '10 at 16:52
  • I've got i think a better solution, as soon as the current composit or class loads, just get hyperlink and set it to the current history token because if a hyperlink fire a history as same as the current one, no change will happen so ReqHyperlink.getHistoryToken(History.getHistoryToken()); – Noor Jan 10 '11 at 07:26
0

I've got i think a better solution, as soon as the current composit or class loads, just get hyperlink and set it to the current history token because if a hyperlink fire a history as same as the current one, no change will happen so

ReqHyperlink.getHistoryToken(History.getToken());

Since Token will the same, value change handler will no fire any event

Noor
  • 19,638
  • 38
  • 136
  • 254