Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Going at the end of a browser page
Message
 
To
07/01/2005 02:32:35
General information
Forum:
ASP.NET
Category:
Web forms
Miscellaneous
Thread ID:
00974921
Message ID:
00975188
Views:
20
Hello Michel,

I have done some testing for myself. And I did the next that worked for me, look if you can adjust to your needs:

Assume you navigate first to a blank.html,having the following tags, delete the quotes for :
"<html>"
"<head>"  
"<script>" 
 function Go(){
      DivGoTo.scrollIntoView(true);
      }
 	
	
"</script>"

"</head>"
"<body>"

"<div id ="DivInner">  </div>"
"<div id ="DivGoTo"> </div> " 

"</body>"

"</html>" 
In the DivInner section you can place with DOM your innerHTML and afterwards you can fire the script that goes to DivGoTo section thatcomes after DivInner section .To do this I placed a webbrowser and a button on the form.

After the button is clicked the webbrowser navigates first to the blank.html, afterwards it creates 1000 lines that is putted in a cBigFile string.
Finally the cBigFile string would be putted in the DivInner section and the javascript is fired such that it goes to the end of the document. Fast and dirty code:
namespace WindowsApplication1
{
    partial class Form1 : Form
    {
        

        string cBigFile = "<pre>";
      
       private void button1_Click(object sender, EventArgs e)
            {
            webBrowser1.Url = @"c:\weggooi\blank.html";
            
            for (int i = 1; i <= 1000; i++)
            {
                cBigFile = cBigFile + "\n" ;
            }
            cBigFile = cBigFile + "</prae>";//prae = actually pre


        }
\\  to write innerhtml and fire the script to go the end section after the:
\\ document is completed
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
                       
            webBrowser1.Document.GetElementById("DivInner").InnerHtml = cBigFile;
            webBrowser1.Document.InvokeScript("Go");
        }

    }
}
>>Maybe if you have the script function in the html header you can fire it with DOM,like :WebBrowser.Document.Script.MyFunction, after you are filling the document with new data/innerHTML.
>
>Well, I did try this approach as well. While nothing was changing, I checked the WebBrowser.Document.Body.OuterHTML and found that my HEAD element was missing. So, I tried WebBrowser.Document.DocumentElement.OuterHTML and I was seeing the HEAD element but only the default. It seems that when an InnerHTML is associated to a Web Browser control, whatever is HEAD written is not processed. So, that approach didn't work as well.
Zakaria al Azhar
My blog on Actuaris.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform