Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dash-dev] Monkey Dynamic Views...

Monkeys,

One feature that I added (exposed via the JS DOM) is the ability to create dynamic web views. This is really neat, and also allows for full 2-way interaction between Eclipse and the web view. You can monitor if the user clicks any link, and if you use a special 'monkey:' link, it will tell the browser not to go anywhere, but fire the event, allowing you to do custom handling of links (this is how the sharing system will work). You can also execute _javascript_ code in the hosted browser and call functions defined in the loaded .html page. Here's an example script to give you a sense of how it works:

/*
 * Menu: Web view example
 * Kudos: Paul Colton
 * License: EPL 1.0
 */

function main()
{
webView = views.getView("webView");
webView.showView(true);
webView.setTitle("Web View Test");
webView.url = ""file:///Users/paul/Desktop/test.htm">file:///Users/paul/Desktop/test.htm";
webView.addEventListener("LocationChanging", onLocationChanging);
}

function onLocationChanging(event)
{
var location = event.innerEvent.location;


if(location.indexOf("monkey:") == 0)
{
webView.execute("alert('" + location + "');");
}
}




Paul Colton
aptana.com | aptana.tv




Back to the top