MonoTouch UIWebView and EvaluateJavascript

…衆ロ難τιáo~ 提交于 2019-12-06 05:23:26

Try this:

string error = webView.EvaluateJavascript("try { window.scrollTo(0,0); } catch (e) { return e.message; }");

(double check my code)

It should get you a better error message. Tell us the value of the string returned.

I suspect the issue isn't MonoTouch, but perhaps iOS5? Safari had drastic changes in iOS5, new javascript engine, etc.

Note that UIWebView is not re-entrant. If the way of loading the (or just the timing of) page changes between iOS release then this may become a problem.

To avoid this just make sure you're not calling back into any UIWebView instance until the loading is completed, e.g. LoadFinished or LoadError is called.

If this does not help then please create a small, self-contained, test case that duplicate the issue and attach it to a bug report at http://bugzilla.xamarin.com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!