I am using WebView to create a user Account in Android.In creating a user,User need to traverse 3 pages in order to complete full registration.I need to inject the script on 2nd page but the problem is the url for creating user in all 3 pages is same (for ex www.mywebpage/createUser).So the problem is - As the url is same I am not able to know that user is on a particular url,then I can inject the script.Is there any other way like (catching string or any id or any tag) so that I can differentiate between pages.
Asked
Active
Viewed 1,508 times
-1
-
@Shabbir Dhangot I dont want url as my question is clearly saying url is same in creating user.I want to distinguish based on the contents not on the url – FiXiT May 09 '16 at 12:48
-
I know how to get Url but I want to distinguish on the basis of Contents of the page – FiXiT May 09 '16 at 12:50
-
If you have access to the webpage, your best solution would be to implement a Javascript interface in your Android code, and from the Registration page trigger the interface so you can inject what you need to. If you do not have access to the web app and the URL is the same as you seem to state, you may need to pull the HTML data from the page and parse based on changes (http://stackoverflow.com/questions/8200945/how-to-get-html-content-from-a-webview) BUT if it is a SPA you may run into other issues. – aminner May 09 '16 at 13:11
1 Answers
0
WebView has public method getUrl() which returns url string. Create object of your web view and find it by id. Or instantiate in a way you need... and just call getUrl() on the object and assign to string.

daxgirl
- 762
- 4
- 10