I need some help with Android's WebView. I am trying to create an app which loads a webpage, I cannot change. The webpage does load a number of javascript files and I am trying to overwrite the behavior of one of the existing objects in them. The problem is that in one of the scripts, this object gets initialized with a constructor and gets reset like:
obj.init();//invokes the method in my ObjInterface class which I inject
obj = new ObjectClass();
obj.init();//invokes the original ObjectClass method
Passed this line, my interface is no longer called and the obj behaves as per default. I have this flags set:
settings.setJavaScriptEnabled(true);
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setDomStorageEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setAllowFileAccess(true);
How could I achieve this? Regards
I am not sure to understand completely your problem. Are you trying to inject an entire javascript class?
Don't know if you can but have you tried to inject converting in string? Something like this:
hope this helps