Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no direct way of passing it. You can string replace the parameter before calling eval, first modify your javascript like this</p> <pre><code>javascript:( function(searchString) { function P(s) { if(s==='') return; var n=srchNode(document.body,s.toUpperCase(),s.length); alert("Found "+count+" occurrence"+(count==1?"":"s")+" of '"+s+"'."); return n; } function srchNode(node,te,len) { var pos,skip,spannode,middlebit,endbit,middleclone; skip=0; if(node.nodeType==3) { pos=node.data.toUpperCase().indexOf(te); if(pos&gt;=0) { spannode=document.createElement("SPAN"); spannode.style.backgroundColor="red"; middlebit=node.splitText(pos); endbit=middlebit.splitText(len); middleclone=middlebit.cloneNode(true); spannode.appendChild(middleclone); middlebit.parentNode.replaceChild(spannode,middlebit); ++count; skip=1; } } else { if(node.nodeType==1&amp;&amp;node.childNodes&amp;&amp;node.tagName.toUpperCase()!="SCRIPT"&amp;&amp;node.tagName.toUpperCase!="STYLE") { for(var child=0;child&lt;node.childNodes.length;++child) { child=child+srchNode(node.childNodes[child],te,len); } } } return skip; } var count=0,scL=0,scT=0,scBL=0,scBT=0; var w=window,doc=document; if(typeof doc.body!='undefined'&amp;&amp;typeof doc.body.scrollLeft!='undefined') { scBL=doc.body.scrollLeft; scBT=doc.body.scrollTop; } if(typeof doc.documentElement!='undefined'&amp;&amp;typeof doc.documentElement.scrollLeft!='undefined') { scL=doc.documentElement.scrollLeft; scT=doc.documentElement.scrollTop; } P(searchString); })("#search#") </code></pre> <p>Then in your C# replace #search# with your SearchString.</p> <pre><code>public void FindOnPage() { var resource = Application.GetResourceStream(new Uri("Resources/FindOnPage/FindOnPage.txt", UriKind.Relative)); string text; StreamReader sr = new StreamReader(resource.Stream); //while((text = sr.ReadToEnd()) != null) if ((text = sr.ReadToEnd()) != null) { text = text.Replace("#search#",SearchBar.Text); //Replace SearchBar.Text with the string you want to search TheWebBrowser.InvokeScript("eval", text); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload