How can I load HTML page in BrowserField?

482 Views Asked by At

I have one HTML page shows map which i want to display in BrowserField. Here is my code.

BrowserFieldConfig _bfConfig = new BrowserFieldConfig();
_bfConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
_bfConfig.setProperty( BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE );
_bfConfig.setProperty(BrowserFieldConfig.USER_AGENT, "MyApplication 1.0");

BrowserFieldRequest request = new BrowserFieldRequest("page.html");
BrowserField myBrowserField = new BrowserField(_bfConfig);
add(myBrowserField);

myBrowserField.requestContent(request);
1

There are 1 best solutions below

1
On

If the "page.html" is local file then,

Everything is OK, except here:

BrowserFieldRequest request = new BrowserFieldRequest("page.html");

Change here like:

BrowserFieldRequest request = new BrowserFieldRequest("local:///page.html");

you are calling the local file, that why we are giving like this.