473,324 Members | 2,178 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,324 software developers and data experts.

WebBrowser.DocumentText being set stays on about:blank sometimes

I have a WebBroswer control, and I set the HTML it will display via
DocumentText, which takes a a string. This shows the HTML code from
the string in the control. But, sometimes, the WebBrowser shows
nothing. Clicking 'view source' shows: "<HTML></HTML>", and the
filename is called "about_blank[1].txt", which is the about:blank URL.

I am aware that when you set this property, the WebBrowser control
automatically navigates to the about:blank URL before loading the
specified text. And that means that the Navigating, Navigated, and
DocumentCompleted events occur when you set this property.

So, for some reason, and only sometimes, the WebBrowser STAYS on
about:blank. Should I handle the events and do something with them to
kick this in the ass and move it forward to actually displaying the
content I am passing it?

Note that adding more HTML to the SAME string and then setting
DocumentText to this will then show the HTML. So, it's finnicky when
it works and doesn't (but, it is consistent on when it does and
doesn't work).

Zytan

Mar 23 '07 #1
2 11107
I guess I am not the only one who has noticed this. It's been
suggested that a "much more elegant and effective way of populating
web browser control with html is to use Write method of Document
object of WebBrowser control".

But, what if the Document object is null? What do I do then? How do
I get to the point of where I can call the Write method within it?

Zytan

Mar 23 '07 #2
So, for some reason, and only sometimes, the WebBrowser STAYS on
about:blank.
http://neovolve.com/archive/2006/02/12/684.aspx

"If you fire up reflector and find the WebBrowser.DocumentText
property you will see ... it will attempt to navigate to about:blank
as the documentation says. The code here indicates that the stream
data will be populated into the browser after it has navigated to
about:blank. The hitch here is that if the navigation fails, you are
none the wiser that the process has failed and the new document text
won't be loaded. My problem with the code here is that the try block
around the navigate swallows the exception, hence the document content
doesn't change and you won't know why."

Zytan

Mar 23 '07 #3

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

Similar topics

5
by: Jerry Schwartz | last post by:
I've cobbled together a script that should load a picture in a new, automatically sized window. Because the image.height and image.width may be 0 if I test them right away, I use setTimeout to loop...
2
by: Trent | last post by:
Hey All, I am new to javascript and currently coding a site with scripts that are beyond my level of understanding. The problematic page has thumbnail images that can be clicked on to zoom in....
3
by: Olivier/Noetika | last post by:
Hi, Inside my application, I have a form that is composed with a listview and a webbrowser. The webbrowser display the focused url contained in the list view. The problem is that this works the...
1
by: David Veeneman | last post by:
In .NET 2.0, how do I clear the contents of a web browser control? I'm using a WebBrowser control in a Windows Form app to display strings genrated by my application and formatted as HTML--I'm...
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...
0
by: micmit | last post by:
I wanted to avoid any HTML file creation , so initial HTML was formed as a string and assigned to DocumentText. After that the aim was to manipulate with html using DOM . It turned out...
4
by: sid | last post by:
"about:blank" oepns new browser window I am writing a webpage that will run on other machines that I may or may not know about. My page is framed where frame1 controls the content of frame2. ...
1
by: sid | last post by:
I am writing a webpage that will run on other machines that I may or may not know about. My page is framed where frame1 controls the content of frame2. What I have found is that if the page in...
2
by: Scott Gravenhorst | last post by:
I recently (within 30 days) downloaded and installed VB 2005 Express. I like it a whole lot... but: I have been trying to work with the WebBrowser control to display a small amount of help text...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.