473,472 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

axWebBrower with on-the-fly content and a JavaScript onclick funti

How do I get a web-browser loaded with on-the-fly content and a JavaScript
onclick popup function to work?

I've embedded an axWebBrowser in my (vb.net) application. The browser
starts with about:blank, and then I set AxWebBrowser1.Document.Body.innerHTML
to the desired HTML. The HTML contains a link (which works fine) and a
Javascript command to put up a popup window. (The popup will show more
on-the-fly content.)

The HTML and popup works great when I put it into a file, but I get a "A
Runtime Error has occured. Do you wish to Debug? Line 9, Error: Object
required." The HTML works fine if it's put into a file first, and then I
load it into the embedded browser as a file URL. Starting with the
about:blank and and the javascript onclick seem to be the problem.

I've reduced the code to just a single empty function.. it seems to be a
problem with the onclick that gets confused because I've started with a blank
URL.

Sample code is below. The form has one web browser, one button (to load the
content into the browser), one text box for the created HTML, and one text
box to show the browser tatus.

How do I load content into an embedded browser (on the fly) , so I can load
new content into a popup window (not a URL)? Any ideas?

-- Malcolm

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AxWebBrowser1.Navigate2("about:blank")
End Sub

Public Sub loadwebcontent()
Dim myPopupCode As String
myPopupCode = "<script language=""javascript""
type=""text/javascript"">" & vbNewLine & _
"function popup() { }" & vbNewLine & "</script>" & vbNewLine

' href="#" doesn't work either..
Dim content As String = "<a href="""" onclick=""popup(); return
false;"">popup me</a>" & vbNewLine
content = content & "<p><a href=""http://www.google.com"">google
me</a>" & vbNewLine
Dim myHTML As String = "<html>" & vbNewLine & _
"<head>" & vbNewLine & _
" <title> Popup Listing</title>" & vbNewLine & _
myPopupCode & vbNewLine & _
"</head>" & vbNewLine & _
"<body>" & vbNewLine & _
content & vbNewLine & _
"</body>" & vbNewLine & _
"</html>" & vbNewLine

TextBox2.Text = myHTML

' Found this jewel at
http://www.experts-exchange.com/Prog..._21067341.html
AxWebBrowser1.Document.Body.innerHTML = myHTML

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
loadwebcontent()
End Sub

Private Sub AxWebBrowser1_Enter(ByVal sender As System.Object, ByVal e
As AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEvent ) Handles
AxWebBrowser1.StatusTextChange
TextBox1.Text = e.text
End Sub
End Class

Jul 21 '05 #1
0 1575

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

Similar topics

6
by: Chris Krasnichuk | last post by:
Hello every one, Does anyone know how to make php work on your computer? please reply I need help Chris
20
by: Chris Krasnichuk | last post by:
hello, Does anyone know how I make php work on "my" computer? I made a mistake in my last post so I fixed it here. Chris
0
by: Aldo Polli | last post by:
Hi, I have this error when I start apache2 with php4 Syntax error on line 233 of /mypath/apache2/conf/httpd.conf: Cannot load /mypath/apache2/modules/libphp4.so into server: dynamic linker:...
4
by: Frank | last post by:
Whats best : register_globals ON ? OR register_globals OFF ? I currently use: $_POST
2
by: Patricia | last post by:
I am a new Oracle user. I am trying to install Oracle 9i Personal Edition on Windows ME; however, I am getting the following error during the installation: Oracle Database Configuration Assistant...
57
by: Bing Wu | last post by:
Hi all, I am running a database containing large datasets: frames: 20 thousand rows, coordinates: 170 million row. The database has been implemented with: IBM DB2 v8.1
1
by: gndzkdr | last post by:
hi all, i m new on Sql and i have a project related to C# and Sql. i have to do a project which must work on LAN, and there must be only one database file on main computer(Server Computer) and...
8
by: PhongPham | last post by:
Hello, Info relate: OS : uclinux Platform : unix version 2.4.22 (or 2.4.26) Chip on board : ARM7 I want to get a python package on network to "make" in linux (Fedora core 1 or anything...
19
by: pmw | last post by:
Hi I've got a problem with my current application. I currently use Windows Vista with Visual Studio Express 2008. If I compile the application on Vista, it works fine on Vista, but it doesn't...
16
by: tvnaidu | last post by:
I have these two ON and OFF buttons html code below, based on condition I am displaying status on screen(I have mutliple lines for each LED), my row shifting when some displaying ON and some...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
1
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...
0
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,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.