i try to execute a javascript in Windows phone
IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream location = new IsolatedStorageFileStream(path,
System.IO.FileMode.Open, file);
HtmlDocument doc = new HtmlDocument();
doc.Load(location);
string newContent = "<script type='text/javascript'>"
+ "function getSelectionHtml()"
+ "{"
+ "var html = '';"
+"if (typeof window.getSelection != 'undefined')"
+"{"
+"var sel = window.getSelection();"
+"if (sel.rangeCount)"
+"{"
+" var container = document.createElement('div');"
+"for (var i = 0, len = sel.rangeCount; i < len; ++i)"
+"{"
+"container.appendChild(sel.getRangeAt(i).cloneContents());"
+"}"
+"html = container.innerHTML;"
+"}"
+"}"
+ "elseif (typeof document.selection != 'undefined')"
+ "{"
+ "if (document.selection.type == 'Text')"
+ "{"
+ "html = document.selection.createRange().htmlText;"
+ "}"
+"}"
+"return Html;"
+ "}"
+ "</script>";
HtmlNode newNode = HtmlNode.CreateNode(newContent);
// Get body node
HtmlNode body = doc.DocumentNode.SelectSingleNode("//head");
// Add new node as first child of body
body.PrependChild(newNode);
savefile(doc);
string path4 = "Cyrlej/Epub/The Motor/42461/@public@vhost@g@gutenberg@html@files@42461@42461-h@42461-h-0.htmcopie.html";
MyWebBrowser.Navigate(new Uri(path4, UriKind.Relative));
public static void savefile(HtmlDocument file)
{
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream isoStream =
new IsolatedStorageFileStream("Cyrlej/Epub/The Motor/42461/@public@vhost@g@gutenberg@html@files@42461@42461-h@42461-h-0.htmcopie.html", FileMode.Create, isoStore))
{
file.Save(isoStream);
}
}
i successfully add the script to my html and now when i try to invoke the script by
MyWebBrowser.InvokeScript("getSelectionHtml");
alwayes i get error "Error: 80020006" any one have an idea thank you in advance