|
-
Jul 8th, 2008, 05:37 PM
#1
Thread Starter
Lively Member
[vb2008] Change iFrame src in webbrowser control
Hey Folks, I'm looking to change the iframe src of an iframe in my webbrowser control using an onclick (the javascript triggers window.external.iflink()
and in VB2008 I have:
Code:
Public Sub iflink()
Dim CurrentWindow As HtmlWindow = WebBrowser1.Document.Window
For Each Frame As HtmlWindow In CurrentWindow.Frames 'Get all frames
If Frame.Name = "cf1" Then
Frame.Navigate("csc.php")
End If
Next
End Sub
However the above code doesn't seem to work, how can i target iframe id (cf1) and change its source using an onclick within the webbrowser control?
Many thanks,
n3m.
-
Jul 16th, 2008, 09:11 AM
#2
Thread Starter
Lively Member
Re: [vb2008] Change iFrame src in webbrowser control
-
Jul 17th, 2008, 03:55 PM
#3
Re: [vb2008] Change iFrame src in webbrowser control
Yes, it's possible. You have to supply the fully qualified url string... Also, since you already know the frame name, you don't have to loop thru the frames collection. Try this:
Code:
Dim cf1Frame As HtmlWindow = WebBrowser1.Document.Window.Frames("cf1")
If Not cf1Frame Is Nothing Then
cf1Frame.Navigate("http://www.google.com/")
End If
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|