473,811 Members | 3,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.webBrowser 1.DocumentStrea m = 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.webBrowser 1.Navigate(temp FileName + "#anchor");

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

TIA

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

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

"Andy Bates" <an**@ussdev.co mwrote in message
news:O%******** ********@TK2MSF TNGP03.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.webBrowser 1.DocumentStrea m = 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.webBrowser 1.Navigate(temp FileName + "#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
12639
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 .DocumentStream, but this property is null. The property .DocumentText is = "" too. Am I missing something ? Thank you very much !
1
2823
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 .DocumentStream, but this property is null. The property .DocumentText is = "" too. Am I missing something ? Thank you very much !
11
2849
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
1219
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 make it browse to a page. What I want to do is to get the HTML sourse inside a page. http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentstream.aspx shows a property as follows: Dim instance As WebBrowser Dim...
0
3583
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 into a single MIME encoded file that specifies all of the resources for a page in a single file. This makes a lot of sense as if you could pass one of these to the
1
4100
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 loop. The reason I'm trying to do so is to remove some specific scripts like "alert()" because it locks up the WebBrowser control. When there's an alert box is open, calling Navigate causes an exception. I need other scripts to be executed so I...
6
7552
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 isn't the current directory of the program. What is the current directory? I don't want to use an absolute path, since its contents are saved to disk, and that should always load the css file no matter where it and the css file exists. Titan
3
3175
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 files are created and stored in a temp folder. The older files from temp need to be deleted everytime prior to calling the Navigate function for the current file. But I am getting an exception when i try to delete the temp folder
0
4324
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 with a HttpWebRequest that goes to http://www.microsoft.com and this work fine, however if I change the URL to http://www.telerik.com or http://www.apple.com then the WebBrowser thows an unhandled Permission Denied error. I know that the...
0
9726
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.