473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

WebBrowser navigating with DocumentStream to HTML anchors

Hi -

I have a form hosting the above control. I can generate the HTML as a Stream
and set it in the control using:

this.webBrowser1.DocumentStream = myStreamOfHTML.

The problem is that there are anchor points in the document that I want to
move to either on open or later; question is how do I do this with the above
code?

As the above is setting the document from a stream the Url generally is just
set to about:blank.

The following works but means that I have to save the HTML to a disk file
which I don't want to do as it's sensitve data that is being displayed:

this.webBrowser1.Navigate(tempFileName + "#anchor");

Looking at the code in Reflector this disappears into the IWebBrowser2
Navigate2 method.

TIA

- Andy
Jan 3 '07 #1
1 8359
Found a solution.

I store the anchor I want to move to. Then in the DocumentComplete event I
retrieve all of the anchors in the document (GetElementsByTagName), look for
the fragment ID I want to move to and if found call ScrollIntoView on it.

"Andy Bates" <an**@ussdev.comwrote in message
news:O%****************@TK2MSFTNGP03.phx.gbl...
Hi -

I have a form hosting the above control. I can generate the HTML as a
Stream and set it in the control using:

this.webBrowser1.DocumentStream = myStreamOfHTML.

The problem is that there are anchor points in the document that I want to
move to either on open or later; question is how do I do this with the
above code?

As the above is setting the document from a stream the Url generally is
just set to about:blank.

The following works but means that I have to save the HTML to a disk file
which I don't want to do as it's sensitve data that is being displayed:

this.webBrowser1.Navigate(tempFileName + "#anchor");

Looking at the code in Reflector this disappears into the IWebBrowser2
Navigate2 method.

TIA

- Andy

Jan 5 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Toma Marinov | last post by:
Hello ! I made some test with webbrowser control in VS.2005. When I load a word document in webbrowser through .Navigate method (from my hdd), I want to get the stream of the loaded doc file with...
1
by: Toma Marinov | last post by:
Hello ! I made some test with webbrowser control in VS.2005. When I load a word document in webbrowser through .Navigate method (from my hdd), I want to get the stream of the loaded doc file with...
11
by: Anil Gupte | last post by:
....and how do I insert one into my form? I used in VB 6.0 last, but cannot figure out where it is in .Net Thanx, -- Anil Gupte www.keeninc.net www.icinema.com
0
by: Anil Gupte | last post by:
I once (long time ago in VB 6) used the WebBrowser Control. I looked it up on MSDN and it showed how to add it into the Toolbox. So that worked fine. However, I cannot do much with it other than...
0
by: Andy Bates | last post by:
Hi - This issue seems to have been kicking around since the dawn of time and no one appears to have come up with an answer. In short the MHT/MSHTML provides a method of archiving an HTML page...
1
by: Sin Jeong-hun | last post by:
Is it possible to modify the HTML or the script of a WebBrowser control in DocumentCompleted event? I tried to modify it but that caused DocumentCompleted again so the program fell in an endless...
6
by: titan.nyquist | last post by:
The WebBrowser control won't load a css file written in the same directory as the program. If I put an absolute path to it, it will load it. Thus, the current directory of the WebBrowser control...
3
by: =?Utf-8?B?R2F1cmF2?= | last post by:
I am using the AxSHDocVw.AxWebBrowser control (named PreviewBrowser) in my C# app to load a pdf file: PreviewBrowser.Navigate(strPDF ,ref objNull,ref objNull,ref objNull,ref objNull); These PDF...
0
by: =?Utf-8?B?VGFyZXE=?= | last post by:
Hi I was wondering if it is possible to to set the DocumentStream of the WebBrowser control to the stream that is returned from a HttpWebResponse.GetResponseStream()? I have actually tried this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.