Reputation: 1
How to make a button link to another html page?
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
//this code has to redirect to another page within the project
}
Upvotes: 0
Views: 5305
Reputation: 25
If you wanted a button but not in the script you can try this:
<a href="//Wherever your page is//">YOUR PAGE</a>
<a href="https://stackoverflow.com/">Stack Overflow</a>
Upvotes: 0
Reputation: 8661
No need to use JS. As of HTML5, buttons support the formaction
attribute where you can specify the URL.
<form>
<button formaction="http://stackoverflow.com">Go to stackoverflow!</button>
</form>
Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formaction
Upvotes: -1
Reputation: 21674
Look under gwt javadocs for the Window class. There are some static members in the Window class.
The open function is the same as that in javascript:
Window.open(url, targetFrame, features )
In GWT, "_self" is the name of the current active display frame/window.
Location replace, just as in javascript:
Window.location.replace(url)
Display alert or confirm window:
Window.alert(msg)
Window.confirm(msg)
Upvotes: 4
Reputation: 5488
The question is tagged as GWT so based on that... to do it entirely on the client, you can use the com.google.gwt.user.client.Window
class.
Window.open(linkURL, "_self", "");
Upvotes: 4