Android: Is there a way to execute JavaScript from my app?

后端 未结 4 1160
难免孤独
难免孤独 2021-01-19 11:25

I was hoping to find something in the Android sdk similar to the javax.script package in Java; but haven\'t been able to find anything. Am I missing a way to e

相关标签:
4条回答
  • 2021-01-19 12:09

    Rhino is a port of JavaScript that is implemented in Java. It can run on Android with minor tweaks. You can find the code for it as part of the SL4A project.

    0 讨论(0)
  • 2021-01-19 12:16

    You could embed an invisible browser and have it execute the script. But perhaps there is a better way.

    0 讨论(0)
  • 2021-01-19 12:17

    You can execute JavaScript from within a WebView. Make sure you set WebSettings.setJavaScriptEnabled(true).

    You can find more information here.

    0 讨论(0)
  • 2021-01-19 12:29

    I guess it depends on what you need the JavaScript to do. There is a way to execute JavaScript contained within HTML, ie PhoneGap.

    0 讨论(0)
提交回复
热议问题