Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Activity Indicatior WebView

Hi all,

I was just wondering if it is possible to display activity indicator before the a remote page loads onto a webview? my code so far has been

var webview = Titanium.UI.createWebView({ url: Titanium.UI.currentWindow.param,backgroundColor:'#000' });
var actInd = Titanium.UI.createActivityIndicator({
    height: 50,
    width: 10
webview.beforeload = function() {    

But this does not seem to work. Any help on this would be highly appreciated

— asked May 1st 2010 by sanchit sharma
  • activity
  • android
  • indicator

1 Answer

  • Accepted Answer

    Hey sanchit.. beforeload/onload aren't callbacks that are currently supported in WebView. Instead you'll want to go ahead and show() your Activity Indicator as soon as you've added it, and then you can add a load event listener to the WebView like so:

    webview.addEventListener("load", function(e) {
    — answered May 1st 2010 by Marshall Culpepper
    1 Comment
    • +1 help me too

      — commented February 17th 2013 by Muhammad Wahhab Mirza
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.