WebView.EvaluateJavaScriptAsync return null #23875
Unanswered
CodingOctocat
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have implemented the WebView scrolling to the beginning of the paragraph of the specified string with the help of chatGPT (I need to use this cumbersome method because the target web page is not standardized).
I found that
EvaluateJavaScriptAsync
returnsnull
using a callback function, Promise, but I changed it to the following (direct return value) andresultStr
getstrue/false
.If you use a callback function, Promise, then call
EvalJsToScrollToAsync
in theWebView.Navigated
event, then the scrolling works fine, but the return value isnull
, then callEvalJsToScrollToAsync
again, and the scrolling works fine as well as the return value.But ifjs
is refactored to return the value directly, then the first call toEvalJsToScrollToAsync
will get the return value normally.This is the version that works properly:
Beta Was this translation helpful? Give feedback.
All reactions