简体   繁体   中英

PhoneGap: Inject JS into HTML on page load through Java on Android

I like to inject js code into html when the application is done loading through Java. Actually, I have some code which I don't want anyone to see when they extract the application apk, and when that particular js in is embedded in Java code it would be a little difficult to extract. I know the complete java code for the apk can be decompiled, but this be make things little difficult. Can anyone help in this?

I am using PhoneGap/Cordova 2.1.0 for Android.

Thanks

some solutions:

  1. write plugin, call you code within a cordova.ready callback
  2. extend the droidgap and call super.loadUrl("javascript:window.alert()");

I would suggest the first one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM