@@ -189,32 +189,36 @@ <h3 id="features-javascript-integration">JavaScript integration</h3>
189189 < p >
190190 If you are reading this page in either one of the < strong > CefSharp.Wpf.Example</ strong > or
191191 < strong > CefSharp.WinForms.Example</ strong > sample applications, you can use the boxes on the right side
192- of the screen to run arbitrary JavaScript code towards the context of this page. The C# code for performing
193- these kinds of interactions are quite simple. Like this:
192+ of the screen to run arbitrary JavaScript code towards the context of this page. By default, the content
193+ of the block below will be modified/inspected by the script code.
194+
195+ < pre id ="modify-me "> You can modify the value of this text field using JavaScript!</ pre >
196+
197+ The C# code for performing these kinds of interactions is quite simple. Like this:
194198 </ p >
195199
196200 < pre data-shbrush ="csharp ">
197201 webBrowser.ExecuteScriptAsync(someScriptCode);
198202 </ pre >
199-
203+
200204 < p >
201205 The code above will run the provided JavaScript snippet (which may do interesting things, like
202206 interrogating or modifying the DOM of the page, just to name one example out of many potential ones). The
203207 execution is of the "fire-and-forget" style; any result of the execution is silently disregarded. The
204208 execution is also < em > asynchronous</ em > in nature, a term which means that (among other things) the method
205209 may return before the actual code has actually been executed.
206210 </ p >
207-
211+
208212 < p >
209213 This is the preferrably approach if possible, since it does not deadlock the UI in any way. However, we
210214 realize that it's not suitable for all scenarios. Have faith — there is a solution even for cases
211215 where you < em > do</ em > need to return a value. Just write your code like this:
212216 </ p >
213-
217+
214218 < pre data-shbrush ="csharp ">
215219 var result = webBrowser.EvaluateScript("10 + 20");
216220 </ pre >
217-
221+
218222 < p >
219223 Please note that only a limited number of data types are supported when returning the result above. Simple
220224 value types (int, float, etc) and strings all work, but do not expect to be able to return other JavaScript
0 commit comments