Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

djzmaj

macrumors newbie
Original poster
Feb 26, 2013
1
0
OK, I'm making application for iPhone (Still learning, getting to know Objective-C and Xcode) and it's going pretty well. Application that I'm making is already made for Android. There is a part where application is opening "hardcoded" webpage for Android and that's part where I have problem. JavaScript on that webpage has part of the code that looks something like this:

Code:
<a onclick="Android.setCategory('US');" class="navigator_item cat_US">US</a>

That's the only thing I'm interested in. I would just like to GET that "onclick" part (everything under quotes "Android.setCategory('US');" as a string. So, whenever that part is clicked, I want to get that as a string so I can do my own logic after that, call some method or anything. I tried using

Code:
shouldStartLoadWithRequest
but I wasn't able to log out anything on click. Am I doing something wrong here? Maybe my lack of javascript knowledge is problem and I don't understand basics, but I think it should be possible just to get that part from onclick quotes to string. That's all I need.

Another very important thing. I CAN NOT TOUCH that javaScript file, that is used for Android and that's how Android app works right now. That's why I want to do this "string" stuff.
Is there anything I can do with stringByEvaluatingJavaScriptFromString and document.getElementsByClassName JavaScript method, someone mentioned that but I'm not sure how am I supposed to use that method?



Cheers peps :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.