Saturday, October 31, 2009

Open New Tab in GWT

There is no need to explain about GWT(Google web toolkit).. Most of the developers knew that. If you have not come across any such thing. please do take a look into GWT.

I was having a problem to open a link in new tab using Firefox or IE- 7 or 8. GWT has an API url,String name, String features);

it would open the link in new window and you cant find any scroll bars or anything...

if you use JSNI in GWT, you can open new link in a tab. here is the code to do it.

public static native String getURL(String url)/*-{
return $'url',

Call the method

getURl (String url);

on the click event of the target, you can see it opening in new tab, I have tested it and it worked.



Anonymous said...

url should not be in quotes. Otherwise it works.

Aadhaar said...

Works awesome.. Ya URL should be without quotes..