1

I have created a web browser for windows phone 7. In that am saving the history of browsing also with title of that page. But due to this codes when i tried to load a somewhat big website like thinkdigit,etc. are not loading. At the same time if i delete that particular codes then no history is being recorded in the history page. It shows error for the below highlighted code - "An unknown error has occurred. Error: 80020006". I think its due to big site or else do i need to put milliseconds or what i have to do??? Thanks in advance for your hard work!!!

Below is the codes i have used for it-

private void browsers_Navigated(object sender,System.Windows.Navigation.NavigationEventArgs e)      
{
    pbarWebClient.Visibility = System.Windows.Visibility.Collapsed; 
    if (!fromHistory)
    {
        if (HistoryStack_Index < HistoryStack.Count)
        {
           HistoryStack.RemoveRange(HistoryStack_Index, HistoryStack.Count - HistoryStack_Index);
        }

        HistoryStack.Add(e.Uri);

        if (!app.incognito)
        {
            ********string title = (string)browsers[this.currentIndex].InvokeScript("eval", "document.title.toString()");********----->This is the error.
            stream.WriteLine(title + ";" + e.Uri.ToString());
        }

        HistoryStack_Index += 1;
    }
    fromHistory = false;
    navigationcancelled = false;
    Stop.Visibility = Visibility.Collapsed;
}
Omar
  • 16,329
  • 10
  • 48
  • 66
  • Maybe http://stackoverflow.com/questions/10200661/c-sharp-webbrowser-invokescript-and-error-80020006-only-in-this-particular-site? – Tim M. May 13 '12 at 13:46

2 Answers2

1

I would expect that eval has been overridden or in some other way suppressed on the site(s) in question.

"80020006" is a javascript invocation error code. Simply assuming that a javascript method will be available and work in the same way on any site is not always going to be true.

Matt Lacey
  • 65,560
  • 11
  • 91
  • 143
0

Finally i got the suitable answer for my own question. Just replace the above codes with this-

            if (!app.incognito)
            {
                Thread.Sleep(100);
                Dispatcher.BeginInvoke(() =>
                {
                    string title = (string)browsers[this.currentIndex].InvokeScript("eval", "document.title.toString()");
                    stream.WriteLine(title + ";" + e.Uri.ToString());
                });
            }