|
Rank: Advanced Member Groups: Member
Joined: 9/3/2014 Posts: 68
|
Hi,
I am looking a way to get selected text on the web view of EO.WebBrowser, but cannot find it. Could you please help me how to get selected text on web view, not the whole text of the web view.
Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, The WebView does not expose any methods for you to get that directly. However you can search online to find the correct JavaScript code to do it and then call EvalScript to return that value from JavaScript to your .NET code. See here for more information on how to use EvalScript here: http://www.essentialobjects.com/doc/6/advanced/js.aspx#evalscriptThanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/3/2014 Posts: 68
|
EvalScript does a trick for me. Thank you for your hint.
|
|
Rank: Member Groups: Member
Joined: 6/12/2015 Posts: 20
|
This works great in most cases: EvalScript("window.getSelection().toString();")
However, chrome returns a empty string when using this during BeforeContextMenu
I cannot for the life of me figure out a way to get the Selected Text in the BeforeContextMenu event.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Jason R. wrote:This works great in most cases: EvalScript("window.getSelection().toString();")
However, chrome returns a empty string when using this during BeforeContextMenu
I cannot for the life of me figure out a way to get the Selected Text in the BeforeContextMenu event.
Currently there is no way to get the selection from inside BeforeContextMenu handler. This is explicitly prohibited in our code because of the potential of causing an internal deadlock. We do understand that there is a need to support this inside BeforeCotnextMenu, so we will look into it and see if we can find any clean workaround. Thanks!
|
|