2016-12-06 6 views
1

In meiner App versuche ich, einige Skripts mit der Methode executeScript von InAppBrowser auszuführen. Daran erinnernd, dass i Ionic-Framework v2 bin mit, das ist mein Code:Methode 'executeScript' funktioniert nicht - InAppBrowser

browser.executeScript({ 
      code: ` 
       $(".rodape.geral table tbody tr:nth-child(2) td:nth-child(1) div:nth-child(1)").css("min-width","auto"); 
       $(".rodape.geral table tbody tr:nth-child(2) td:nth-child(1) div:nth-child(1) div:nth-child(1)").css("width","auto"); 
       $(".rodape.geral table tbody tr:nth-child(1) td:nth-child(2) table:nth-child(1)").attr("align","center"); 
      ` 
      }).then((e)=>{ console.log('JS adicionado.'); }).catch((e)=>{ console.log('Erro ao adicionar JS. '+e); }); 

Warum ist der Code nicht funktioniert und kein Rückruf Rückkehr? Thks.

Antwort

0

Stellen Sie sicher, dass sich dieser Code im loadstop Ereignis-Listener für den inAppBrowser befindet.

Die Browseransicht muss geladen werden, bevor Sie JS ausführen können.

Verwandte Themen