2015-03-31 1 views
0

Salut je travaille dans Cordova v3.7 et themeablebrowser Cordova plugin en veulent obtenir le titre de la page dans themeablebrowser je ne peux pas l'obtenir. J'ai essayé executeScript comme spécifié dans la documentation, mais les plantages d'application. voici ce que j'ai fait jusqu'ici.Titre de la page dans themeablebrowser Cordova/Phonegap

function innAppInit(_url) { 
    app.Log('browser news link=' + _url); 
    if (_url == null) { 
     _url = 'http://apache.org'; 
    } 
    var ref = cordova.ThemeableBrowser.open(_url, '_blank', { 

     backButtonCanClose: false, 
     hideForwardButton: true, 
     toolbarColor: '#239EC9', 
     titleColor: '#FFFFFF', 
     statusbarColor: '#239EC9', 
     navButtonAlign: 'left', 
     closeButtonAlign: 'right', 
     menuButtonAlign: 'right', 
     titleStaticText: 'Add New Web Page', 

     menuButtonImage: 'themeablebrowser_stub_menu', 
     menuButtonPressedImage: 'themeablebrowser_stub_menu_highlight', 
     closeButtonImage: 'themeablebrowser_stub_close', 
     closeButtonPressedImage: 'themeablebrowser_stub_close_highlight', 
     backButtonImage: 'themeablebrowser_stub_back', 
     backButtonPressedImage: 'themeablebrowser_stub_back_highlight', 
     // menuTitle: 'Add Url to list', 
     menuCancel: 'Cancel', 
     menuItems: [{ 
      event: 'event_getURL', 
      label: 'Add' 
     }] 
    }); 

    ref.addEventListener('loadstart', function(event) { 
     try { 
      app.Log('loadstart function'); 
      $('.ui-loader').show(); 

     } catch (e) { 
      app.ErrorLog(e); 
     } 
    }); 
    ref.addEventListener('loadstop', function(event) { 
     try { 
      app.Log('loadstop function'); 
      $('.ui-loader').hide(); 


      ref.executeScript({ 
        code: 'return document.title' 
       }, 
       function(values) { 
        alert(values);      
       }); 

     } catch (e) { 
      app.ErrorLog(e); 
     } 
    }); 
    ref.addEventListener('event_getURL', function(event) { 
     try { 

      var url = event.url; 
      app.Log('get url=' + url);   
      ref.close(); 

     } catch (e) { 
      app.ErrorLog(e); 
     } 
    }); 
    ref.addEventListener('exit', function(event) { 
     try { 
      app.Log('exit function');    

      $('.ui-loader').hide(); 

     } catch (e) { 
      app.ErrorLog(e); 
     } 
    }); 
} 

Répondre