var URL = "Your website URL"
var URL2 = webview.GetUrl();
if ( URL2==URL ){
}
else {
app.OpenUrl( URL2 );
}
var loadComplete = false;
var defaultUrl = "http://www.google.com";
var currentUrl = null;
function OnStart()
{
var lay = app.CreateLayout( "Linear", "VCenter" );
var web = app.CreateWebView( 1.0, 1.0, "IgnoreErrors,NoScrollBars" );
web.SetOnProgress( UseBrowserForLinks );
lay.AddChild( web );
app.AddLayout( lay );
web.LoadUrl( "http://www.google.com" );
}
function UseBrowserForLinks( progress )
{
// Treating the first URL
if( !loadComplete )
{
if( progress === 100 )
{
// Indicates the first URL is loaded
loadComplete = true;
// Saves the loaded URL as defaultURL (in case of redirection or sth)
defaultUrl = this.GetUrl();
}
}
// For the other URLs
else
{
var url = this.GetUrl();
// Ignore the defaultURL and the currentURL
if( url !== null && url !== defaultUrl && url !== currentUrl )
{
// Updates currentURL to not re-open it
currentUrl = url;
// Go back to the first URL (equals "this.LoadUrl( defaultUrl );" )
this.Back();
// Open the link's URL in default web browser
app.OpenUrl( currentUrl );
}
}
}
function OnStart()
{
var lay = app.CreateLayout( "linear", "VCenter,FillXY" );
var txt = app.CreateText( "", -1, -1, "Html,Links" );
txt.SetTextSize( 32 );
lay.AddChild( txt );
app.AddLayout( lay );
txt.SetHtml( "<a href='http://www.google.com'>Test me :)</a>" );
}