Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi All, InternetExplorer.AddressBar = False was working fine with IE 8. But in IE 9, this does not work. Address Bar is visible. Please help.

Code:

VB
Dim sctest As ScriptControl 
Dim scode As String 
scode = " function OnProgramLoad() { window.open(""" & "http://www.google.co.uk/" & """, """ & "mywindow" & """); } " 
If Len(scode) < 1 Then Exit Sub 
If InStr(1, scode, "OnProgramLoad", vbTextCompare) = 0 Then Exit Sub 
Set sctest = New ScriptControl 
With sctest 
    .Language = "JScript" 
    .AllowUI = True 
    .AddObject "Application", App 
    .AddObject "Clipboard", Clipboard 
    .AddObject "Printer", Printer 
    .AddObject "Screen", Screen 
    .AddCode scode 
    .Run "OnProgramLoad" 'Error is thrown here
End With 
Set sctest = Nothing


[Edit, 2013-MAY-27 Marco Bertschi]
Added source code to OP from comments below my solution.
Posted
Updated 26-May-13 21:35pm
v2
Comments
Sergey Alexandrovich Kryukov 24-May-13 2:48am    
Why?!
—SA
Surekha RS 24-May-13 3:42am    
Not sure about the problem. When the application is opened in Windows 7 with IE 9.0, the address bar is visible, although it is set to False.
Prasad Khandekar 24-May-13 3:45am    
I think the ability to hide address bar was removed in later versions of Internet Explorer as it can pose a security risk.
Surekha RS 24-May-13 4:44am    
Yes. Is there a workaround for it. In our application, we dont have to display the address bar.

1 solution

The feature of hiding the adress bar was removed in later versions of IE.
However, there is a workaround:

You need to use JavaScript to hide the adress bar, since it is not possible to hide it with VB 6, ASP.Net etc.:
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml[^]

cheers,
Marco
 
Share this answer
 
Comments
Surekha RS 24-May-13 5:39am    
How to use Javascript in VB6 application?
Surekha RS 27-May-13 3:14am    
Please help. I am trying to hide address bar using Javascript as below. But it throws Run time error '5009' : window is undefined.

Dim sctest As ScriptControl
Dim scode As String
scode = " function OnProgramLoad() { window.open(""" & "http://www.google.co.uk/" & """, """ & "mywindow" & """); } "
If Len(scode) < 1 Then Exit Sub
If InStr(1, scode, "OnProgramLoad", vbTextCompare) = 0 Then Exit Sub
Set sctest = New ScriptControl
With sctest
.Language = "JScript"
.AllowUI = True
.AddObject "Application", App
.AddObject "Clipboard", Clipboard
.AddObject "Printer", Printer
.AddObject "Screen", Screen
.AddCode scode
.Run "OnProgramLoad" 'Error is thrown here
End With
Set sctest = Nothing
Marco Bertschi 27-May-13 3:36am    
You can't use javascript directly on your VB 6 code - JavaScript is a script language for web pages only.
Surekha RS 27-May-13 4:40am    
Ok. Thanks for your reply. We are trying to open a browser window without toolbar. What can we do? Do we have any other option?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900