Blocks Pop-ups and you can still open links in a new window.
Hey man.
I have been making my web browser, and it rocks!!
but i downloaded yours, and was interested to see the "File, Tools, Internet Options"
This looks like a hugely useful tool, but i cant make it work!!!
What code did you use to open the Internet Options please??
That is not an acceptable question to ask on this site.
Assisting in violating your schools rules or security systems (no matter how justified you think it is) is against our rules - see the Acceptable Use Policy link at the bottom of all VBForums pages.
that was just an example so that people would get what i meant, I'm not going to use it for malicious purposes, that would get me banned from the school computers.
and besides, if I wanted to do that I'd just use a proxy; there are hundreds of them lying around the interwebs.
Is it even possible to encrypt all URLs passing through the browser?
Last edited by joebobfrank; Jun 23rd, 2008 at 12:24 AM.
I'm not aware of any valid reason for doing that - only for bypassing security systems (which often block proxies).
As you have not given another reason, I have serious doubts of your intentions, and cannot allow an answer (from anyone) unless you send me a valid reason via Private Message.
Ok here's how to open up the page source in notepad and not keep it stored on your hard drive (so you don't have to manually delete the source code text files)
Code:
Private Sub MenuSource_Click()
Text1.Text = Form1.WebBrowser1.Document.documentElement.innerHTML
Dim hFile As Long
Dim sFilename As String
sFilename = "c:\tempsource.txt"
'obtain the next free file handle from the
'system and and save the text box contents
hFile = FreeFile
Open sFilename For Output As #hFile
Print #hFile, Text1.Text
Close #hFile
Dim strtest As String
Dim FileSystemObject As Object
strtest = "notepad c:\tempsource.txt"
Shell strtest, vbNormalFocus
Kill "c:\tempsource.txt"
End Sub
Another thing to add to the tutorial
Code:
Private Sub MenuFind_Click()
WebBrowser1.ExecWB OLECMDID_FIND, OLECMDEXECOPT_DODEFAULT
End Sub
Last edited by joebobfrank; Jun 23rd, 2008 at 10:17 PM.
i keep on getting this error Run-time error '-1 (ffffffff)'
when i put these codes
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
Dim i As Integer
Dim bFound As Boolean
Me.Caption = WebBrowser1.LocationName
For i = 0 To cboAddress.ListCount - 1
If cboAddress.List(i) = WebBrowser1.LocationURL Then
bFound = True
Exit For
End If
Next i
mbdontnavigatenow = True
If bFound Then
cboAddress.RemoveItem i
End If
cboAddress.AddItem WebBrowser1.LocationURL, 0
cboAddress.ListIndex = 0
mbdontnavigatenow = False
End Sub
what will i do?
doesn't mbdontnavigatenow needs to be declared?
i keep on getting this error Run-time error '-1 (ffffffff)'
when i put these codes
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
Dim i As Integer
Dim bFound As Boolean
Me.Caption = WebBrowser1.LocationName
For i = 0 To cboAddress.ListCount - 1
If cboAddress.List(i) = WebBrowser1.LocationURL Then
bFound = True
Exit For
End If
Next i
mbdontnavigatenow = True
If bFound Then
cboAddress.RemoveItem i
End If
cboAddress.AddItem WebBrowser1.LocationURL, 0
cboAddress.ListIndex = 0
mbdontnavigatenow = False
End Sub
what will i do?
doesn't mbdontnavigatenow needs to be declared?
Under Option Explicit
Type in Private mbdontnavigatenow as Boolean.
That will work. Trust me.
Code:
Option Eplicit
Private mbdontnavigatenow as Boolean
The other codes go below the "Option Explicit" and "Private mbdontnavigatenow as Boolean" lines
You were able to add the DLL, right, but not the mshtml.tlb?
Don't know exactly how you are doing it but the mshtml.tlb should be added to the reference list (not the components list). Is this what you are trying to do with out success?
I am also trying to get a tabbed web browser, but on the moment I have problems with my progressbar. My progressbar doesn't stay on the place I want it to have with my screen maximized. If I resize my screen it replaces perfectly.
If someone could help me with Tabs or my progressbar, I would really appreciate that.
Last edited by Smak_Rice; Nov 24th, 2008 at 11:01 AM.
Using the method in the tutorial, how could you display the blocked pop-up? Using Internet Explorer 7, it displays the yellow bar and you have the option of allowing the pop-up, but it refreshes the page in order to do it. I've managed to achieve the same effect, however, is there a way of doing it without refreshing?
Blocks Pop-ups and you can still open links in a new window.
I have been looking for a way to open links in new window when a user RIGHT clicks on the menu and selects Open In New Window. This app is the only one I found that opens a new window,,, but there is no Source for VB6...
Can anyone supply the actual example on HOW TO open a a link in new window when user right clicks on the link and selects OPEN IN NEW WINDOW
I have tried to use this tutorial to open up a web page, fill out a form (you put in an IP address and info about that address comes out after submission) and extract the data from the form.
It works in the web browser window, I display the data from the filled out form successfully.
However, after the data is displayed the "WebBrowser1.Document.body.innerHTML" values do not match the displayed information.
Why is this.
Here is my code-
Code:
Private Sub Command1_Click()
Dim doc As HTMLDocument
Dim strHTML As String
'go to the altavista (text) search page
WebBrowser1.Navigate "http://www.ip2location.com/free.asp"
'Wait until page is loaded
Do
DoEvents
Loop Until Not WebBrowser1.Busy
'Make doc reference to the document inside the webbrowser control
Set doc = WebBrowser1.Document
'Set field ipaddresses with the value of Text1
SetInputField doc, 0, "ipaddresses", Text1
'Submit the form
doc.Forms(0).submit
'Wait until result are loaded
Do
DoEvents
Loop Until Not WebBrowser1.Busy
'loop till we have some stuff in strHTML
Do
DoEvents
strHTML = WebBrowser1.Document.body.innerHTML
Loop Until (Len(strHTML) > 400)
'
' read in the text into string variable
'
strHTML = WebBrowser1.Document.body.innerHTML
Text2.Text = strHTML
'
'text is not matching the window.
'
What I want to do is put in some ip addresses and "submit" and then extract the results from a string variable. I see in the screen the results but the variable does not match. Using VB6 and IE6
The information that you inserted into a field on the page is only valid for that page. After you submit the Form you sit and wait for the returned responses which will be a new page. The information on one page doesn't mean it is going to be there on another page. Another problem you should recode to have your fields that you want to fill in be done in the _DocumentComplete event and not as the result of a loop being terminated by Loop Until Not WebBrowser1.Busy. I say this because the indicator .Busy can be triggered before the document has actually completed the process but in the _DocumentComplete event you are gauranteed that the process has completed.
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
Hello VB Forums!
Since this is a Internet Explorer based web browser, the code for the search bar was simple:
All you need is :
-1x Text Box
-1x Button
(and one, pre-existing URL bar)
And the code:
Code:
Private Sub BUTTON_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON.Click
WebBrowser1.Navigate("http://www.google.com.au/search?hl=en&source=hp&q=" + SEARCHBOX.Text + "&meta=&aq=null&oq=googl")
URLBOX.Text = ("http://www.google.com.au/search?hl=en&source=hp&q=" + SEARCHBOX.Text + "&meta=&aq=null&oq=googl")
End Sub
Second, that is still not the way to do it because you are using hard-coded string URL to be placed in the textbox
Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.
The information that you inserted into a field on the page is only valid for that page. After you submit the Form you sit and wait for the returned responses which will be a new page. The information on one page doesn't mean it is going to be there on another page. Another problem you should recode to have your fields that you want to fill in be done in the _DocumentComplete event and not as the result of a loop being terminated by Loop Until Not WebBrowser1.Busy. I say this because the indicator .Busy can be triggered before the document has actually completed the process but in the _DocumentComplete event you are gauranteed that the process has completed.
I dont understand- how do I use _DocumentComplete event?
I have seen this code but don't really understand when its called, would you do a loop until Page_Loaded is True (obvoiusly you set it to False before calling)?-
Code:
Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.object) Then
Page_Loaded = True
End If
End Sub
After I submit the form how would I retreive the data?
And finally how do I block the popup that results from the submission of the form?
EDIT-- I put a breakpoint into the part that read the data (breakpoint at strHTML = ***). My code works excpet that upon form submission you get a popup and my code reads the popup not the form that I submited. If I run this and close the popup manually when the breakpoint is hit I get the correct data. So I guess the critical thing in addition to correctly figuring out when the pages are done is to figure out how to prevent the popup or to close it before reading in the data. I have read the first page of this thread dealing with popups but it confuses my small brain! help!
Last edited by John1in2; Sep 3rd, 2009 at 04:18 PM.
Hi All I am new to the broswer and the tutorial is great thanks! - Im using the VBA version which I assume is the same control as VB6. Just a quick issue - Im tying to create a versioning control software for Excel, that uses a web address to access an Excel file. Problem that I have is that when the webbrowser access a specified .xls document it opens the spreadsheet in the broswer itself not requesting the user to download the file. Im still new to the control and cant find how to force the control to download the file rather than just display it in the actual webbrowser, any help would be great!
Fixes:
Hyperlink in new window fixed
Popup block fixed
Back & Forward button enable fixed
Status fixed
Unfixed:
None as of now :-D
Enjoy my new project. Feel free to rename the objects/program name if desired, and to fix the version number, go to: Project > Project1 Properties...
Make tab, type in a desired number (Integers only), click OK, save every form project, and the project, make an EXE, make an installation project from Start > Programs (All Programs for others) > Microsoft Visual Studio 6.0 > Microsoft Visual Studio 6.0 Tools > Package & Deployment Wizard
Follow the instructions, burn the files to a CD, install the program on other machines.
Next project might contain the Full Screen option & Windows Updates (Windows 95 & Higher only)
edit: to go onto the last visited site, remove the "Visited: Username@" line from the Text box, and click Go, but select the "Visited History" from the drop-down menu, click Get Cache, and select the site that you visited last.
Last edited by MSWindowsUser; Sep 5th, 2009 at 11:28 PM.
Reason: Notes for other users :D
Hy guys I had a problem with that code in webbrowser tutorial
I need use a webbrowser with one single window. Then I used the example
"Open in new window
VB Code: 'This to open a new window with our browser.Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)Dim frm As Form1Set frm = New Form1Set ppDisp = frm.WebBrowser1.Objectfrm.ShowEnd Sub "
However if i click on link that open in other window the browser show a blank page. It cant open any link with new page