www.webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

WebView

Example usage:

In the scene view file:

<div id="storyWeb" x-mojo-element="WebView"></div> 

The scene assistant:

//  StoryWebAssistant(storyURL) 
// 
//  Passed a URL and displays the corresponding story or link in a webview, 
//  handling any link selections within the view. User swipes back to 
//  return to the calling view. 
// 
//  storyURL    unescaped form of URL 
function StoryWebAssistant(storyURL) { 
  //  Save the passed URL for inclusion in the webView setup 
  this.storyURL = storyURL; 
} 
StoryWebAssistant.prototype.setup = function() { 
  //  Setup up the WebView widget 
    this.controller.setupWidget('storyWeb', { 
               url: this.storyURL 
          }, 
          this.storyViewModel = { 
          } 
    ); 
    //    Setup handlers for any links selected. 
    // 
    this.controller.listen('storyWeb', Mojo.Event.webViewLinkClicked, 
      this.linkClicked.bindAsEventListener(this)); 
    //  Setup App Menu 
    this.controller.setupWidget(Mojo.Menu.appMenu, newsMenuAttr, newsMenuModel); 
}; 

To display the webview on click:

// Setup handlers for taps to the story body and links within the story 
this.clickHandler = this.webStory.bindAsEventListener(this); 
this.controller.listen("storyViewSummary", "click", this.clickHandler, true); 
this.controller.listen("storyViewScene", Mojo.Event.tap, this.clickHandler); 

 mojo webview widget

 

webOS UI Widget List