473,671 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebBrowser.Docu mentText 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_blan k[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
DocumentComplet ed 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 11132
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.Docu mentText
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
7134
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 until they are both not zero. I've run into two problems: - In IE, the script doesn't seem to loop. If the picture isn't already cached, nothing appears to happen; if it is in cache, the window (rather slowly) opens up. - In Netscape, the...
2
1898
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. When clicked, the preloaded larger image displays in a div layer that gets turned on. The problem is that ie sometimes does not display the image - the placeholder just stays blank. The script works fine in firefox and netscape (haven't tried...
3
1618
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 first time, that's to say when I call the form just after launching the application, but if I hide the form (me.hide) and show it again (form.showdialog) the webbrowsercontrol stays blank. I tried to put only a direct url like...
1
41016
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 not using it to do any actual web browsing. I use 'webBrowser1.DocumentText = myText' to load an HTML string into the control. But I can't clear that text when I want to load a new string into the control.
6
7543
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
0
1586
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 when dynamically adding rows to table ctable = (mshtml.HTMLTableClass)htable.DomElement; foreach (T row in table) { crow = (mshtml.HTMLTableRowClass)ctable.insertRow(currow++); crow.id = rowId + "_" +...
4
3089
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. What I have found is that if the page in Frame2 fails to load and I get an error page. when I detect an error page I want to set frame2.location.href = "about:blank" and then write a temp error page until the server becomes available again. The...
1
1937
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 Frame2 fails to load and I get an error page. when I detect an error page I want to set frame2.location.href = "about:blank" and then write a temp error page until the server becomes available again. The problem is that the security on some...
2
6350
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 for my application and though I've finally made it work, it seems a bit quirky, so perhaps that's the control being quirky or perhaps there is something I don't understand. 1) I could not figure out a way to make the webbrowser object display a...
0
8917
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
8821
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...
1
8598
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7437
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
6229
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
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4225
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...
2
1809
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.