Iphone - >我如何模拟点击javascript动作?

时间:2023-01-23 21:14:39

i try to simulate a clic on a "javascript:void(0)"; Because i need html data in this script

我尝试在“javascript:void(0)”上模拟clic;因为我在这个脚本中需要html数据

But how i can do this?

但我怎么能做到这一点?

I work only with NSUrl (and I don't won't use illegal API like UITouchEvent)

我只使用NSUrl(我不会像UITouchEvent那样使用非法A​​PI)

Thx for all :)

感谢所有:)

1 个解决方案

#1


1  

Not sure exactly what it is you're trying to do, but assuming that you are trying to do this within a UIWebView then you can do this:

不确定你正在尝试做什么,但假设你试图在UIWebView中执行此操作,那么你可以这样做:

[myWebView stringByEvaluatingJavaScriptFromString:@"JAVASCRIPT GOES HERE"];

You can then execute any javascript that you liken the page

然后,您可以执行您将该页面比作任何javascript

Hope this helps :)

希望这可以帮助 :)

#1


1  

Not sure exactly what it is you're trying to do, but assuming that you are trying to do this within a UIWebView then you can do this:

不确定你正在尝试做什么,但假设你试图在UIWebView中执行此操作,那么你可以这样做:

[myWebView stringByEvaluatingJavaScriptFromString:@"JAVASCRIPT GOES HERE"];

You can then execute any javascript that you liken the page

然后,您可以执行您将该页面比作任何javascript

Hope this helps :)

希望这可以帮助 :)