Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package com.acme.demo.browserfunction;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.BrowserFunction;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
public class DemoBrowserFunctionView extends ViewPart {
private static final String HTML =
"<html>" +
"<body>" +
"<a href=\"#\" onclick=\"helloWorld(); false;\">Test</a>" +
"</body>" +
public DemoBrowserFunctionView() {
// TODO Auto-generated constructor stub
public void createPartControl(Composite parent) {
Browser browser = new Browser(parent, SWT.NONE);
new BrowserFunction(browser, "helloWorld"){
public Object function(Object[] arg0) {
System.out.println("hello world called from javascript!");
return null;
public void setFocus() {
// TODO Auto-generated method stub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.