473,324 Members | 2,166 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.

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 1566

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...
1
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: 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...

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.