Replies: 1 comment 4 replies
-
If you are asking can you evaluate JavaScript in OnBeforeBrowse? Only if you were to cancel the navigation.
Without knowing what |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
CefSharp Version
88.2.90
.Net Version
.Net Framework 4.6
Description
I can execute JS code in FrameLoadEnd/FrameLoadStart/LoadingStateChanged by attach a async method
The page (a login page) I loaded use Vue.js and redirect by
e.$router.push('/xxx')
.The FrameLoadEnd/FrameLoadStart/LoadingStateChanged event wasn't triggered after
e.$router.push('/xxx')
. called.But I found request handler can intercept that on
OnBeforeBrowser
.So I implemented a class inherited from
RequestHandler
and overrideOnBeforeBrowser
.I need to do something with the redirect url.
What I trying to do.
In the override method
OnBeforeBrowser
, I execute a JS codedocument.getElementById('xx')
, the task always showWaitingForActivation
.And I tried add a 3s timeout to
ExecuteScriptAsync("document.getElementById('xx')", timeOut: TimeSpan.FromSeconds(3))
, the task was always canceled and throw a exception.Question
Is that I shouldn't execute JS code in the
RequestHandler
?Is there any alternative solution to that?
Beta Was this translation helpful? Give feedback.
All reactions