-1
Public WebView view;  
var url = "javascript:(function() { var parent = document.getElementsByTagName('head').item(0);var script = document.createElement('script'); script.type = 'text/javascript'; script.innerHTML =\""+  content + "\";parent.appendChild(script)})()"; 
view.LoadUrl(url);
Denny
  • 1,766
  • 3
  • 17
  • 37
meera
  • 1
  • 6
  • Possible duplicate of [How to add DOM element script to head section?](https://stackoverflow.com/questions/18784920/how-to-add-dom-element-script-to-head-section) – Daniel Mizerski Jun 19 '17 at 12:40

1 Answers1

0

You need to use HttpUtility.JavaScriptStringEncode(content) to encode this string:

\
"
' 

into this:

\\
\"
\'
JanErikGunnar
  • 211
  • 1
  • 7