Eclipse Browser widget doesn’t set URL

less than 1 minute read

You can see a sample code of this problem over here. Here is the code I used:

Runnable runner = new Runnable() {
  @Override
  public void run() {
    File index = new File(getMyURL());
      if (index.exists()) {
        browser.setUrl(getMyURL());
      }
    browser.refresh();
  }
}
Display.getDefault().syncExec(runner)

Long story short, I just want to refresh the page with new URL. However even though getMyURL() gives correct string, browser gets never updated. Only after second try, it gets updated (sometimes). Apparently the problem was refreshing the browser. setUrl works just fine, no need to refresh it afterwards. So if you remove the refresh line, it works like charm.

Leave a Comment