2016-12-06 22 views
1

私のアプリで、私はInAppBrowserのexecuteScriptメソッドを使っていくつかのスクリプトを実行しようとしています。私がIonic Framework v2を使用していることを思い出して、これは私のコードです。メソッド 'executeScript' not working - 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); }); 

なぜコードが機能しておらず、コールバックを返さないのですか? Thks。

答えて

0

このコードがinAppBrowserのloadstopイベントリスナーにあることを確認してください。

JSを実行するには、ブラウザビューを読み込む必要があります。