Click to See Complete Forum and Search --> : Back button of web browser
msdnexpert
Dec 30th, 2000, 06:47 AM
Hi all,
Some queries regarding the back button in the web browser.
How does one disable only the back button of the web browser?
Is it possible to add an input button on the HTMl page and make its functionality equivalent to the back button?
Thanks in advance.
sebs
Dec 30th, 2000, 07:32 AM
you can't disable the back button, but you can put
a button that do the same that the back button.
<input type="button" value="back" onClick="history.go(-1);">
<input type="button" value="forward" onClick="history.go(1);">
<input type="button" value="refresh" onClick="history.go(0);">
To do it in the WebBrowser Control:
'Author: Sebastien Levesque
'Origin: http://www.planet-source-code.com
'Purpose: enable / disable back & forward in a webbrowser control
'Version: VB5+
Private Sub WebBrowser1_CommandStateChange(ByVal Command As Long, ByVal Enable As Boolean)
On Error Resume Next
Select Case Command
Case CSC_NAVIGATEFORWARD
If Enable = True Then
'Forward dispo
ForwardEnable = True
RaiseEvent ForwardUpdate(True)
Else
'Forward non dispo
ForwardEnable = False
RaiseEvent ForwardUpdate(False)
End If
'Pas de forward
Case CSC_NAVIGATEBACK
If Enable = True Then
BackEnable = True
RaiseEvent BackUpdate(True)
'Back dispo
Else
BackEnable = False
RaiseEvent BackUpdate(False)
'Back non dispo
End If
End Select
If Command = -1 Then Exit Sub
'End If
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.