Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-553] WebViews events are not works in android

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:53:29.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
ComponentsAndroid
Labelsandroid, event, feature, webview
Reporterjimmy
AssigneeDon Thorp
Created2011-04-15T02:31:42.000+0000
Updated2012-03-14T14:05:40.000+0000

Description

It looks webviews in android only receive 'load' events.
beforeload, click and other events in the api docs do not works.

Comments

  1. Don Thorp 2011-04-15

    There is a beforeload event in iPhone. There may be others.

  2. krati 2011-04-15

    I want to open pdf on webview .Pls suggest.
    I am getting Error 401 while loading url on webview android.

  3. Don Thorp 2011-04-15

    @krati this is not the support forum. Please do not post questions here. Go to http://developer.appcelerator.com/questions/created">Q&A on the developer website.

  4. Bill Dawson 2011-04-15

    This will be in 1.5

  5. Bill Dawson 2011-04-15

    (from [0b0328c15cd4fde434002b721b94e55a1682ccb2]) [#553 status:fixed-in-qa] Support beforeload event. http://github.com/appcelerator/titanium_mobile/commit/0b0328c15cd4fde434002b721b94e55a1682ccb2"> http://github.com/appcelerator/titanium_mobile/commit/0b0328c15cd4f...

  6. Bill Dawson 2011-04-15

    Sample test app.js. You will see notification windows showing beforeload (and load, after a three second delay after the page has loaded -- so the notifications don't run into each other.)

       var notification = Ti.UI.createNotification({
           duration: Ti.UI.NOTIFICATION_DURATION_LONG
           
       });
       function showStatus(text)
       {
           notification.hide();
           notification.message = text;
           notification.show();
       }
       
       Titanium.UI.setBackgroundColor('#000');
       var win = Titanium.UI.createWindow({  
           title:'Test',
           backgroundColor:'#fff',
           exitOnClose: true
       });
       
       var wv = Ti.UI.createWebView({top:50});
       wv.url = "http://www.google.com";
       wv.addEventListener('click', function() {
           showStatus("webview clicked");
       });
       win.add(wv);
       
       var topbar = Ti.UI.createView({
           top:0, left: 0, right: 0, height: 45,
           backgroundColor: 'blue'
       });
       
       var backButton = Ti.UI.createButton({
           left: 10, top: 0, height: 45, width: 100,
           title: 'Back', enabled: false
       });
       backButton.addEventListener('click', function(){
           wv.goBack();
       });
       
       var reloadButton = Ti.UI.createButton({
           left: 115, top: 0, height:45, width: 100,
           title: 'Reload'
       });
       reloadButton.addEventListener('click', function() {
           wv.reload();
       });
       
       wv.addEventListener('load', function(e) {
           backButton.enabled = wv.canGoBack();
           setTimeout(function() {showStatus("page loaded: " + e.url);}, 3000);
       });
       
       
       wv.addEventListener('beforeload', function(e) {
           backButton.enabled = wv.canGoBack();
           showStatus("page beforeload: " + e.url);
       });
       
       topbar.add(backButton);
       topbar.add(reloadButton);
       win.add(topbar);
       win.open();
       
  7. Thomas Huelbert 2011-04-15

    1.5.0.02c2c264 g1 and 2.2. sim

  8. kosso 2011-12-10

    While there is indeed a 'load' and 'beforeload' event now since the fix, there is no 'error' event in TiWebViewClient.java This had be flummoxed for ages and is a definite and urgent requirement.
  9. kosso 2011-12-10

    had 'me' flummoxed... (no edit)

JSON Source