Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

.VBS VBScript to Launch URL & NOT add to history

Posted on 2011-03-11
17
Medium Priority
?
1,520 Views
Last Modified: 2012-05-11
I need to use VBScript (.vbs file) to open a URL, but not add the URL to the browser history. This is NOT for MS Access VBA -- but...
...In VBA in MS Access, if I were using it, I would use:
Application.FollowHyperlink "http://www.google.com", , , AddHistory:=False
...but again I need to use VBS.

I don't see a property in the MSDN documentation (if it's even the right documentation) at http://msdn.microsoft.com/en-us/library/aa752084(v=vs.85).aspx

So how does Application.FollowHyperlink do it, and how can I do something similar in VBA? (I just don't want this particular link to get added to the history, I don't want or need to delete all my history.)
Option Explicit 
Dim IE 
Set IE = wscript.createobject("internetexplorer.application","IE_") 
With IE
	.visible = False
	.AddHistory = False
	.navigate ("http://www.google.com/") 'May contain website login info, and thus I don't want this to be added to this history. How do I implement that?
	while (.busy)    'wait until the site gets loaded 
		wsh.sleep 400
	wend
	while (.ReadyState = 4) 'ReadyState_Complete
		wsh.sleep 400
	wend
	'IE.visible = True 'Commented to continue hiding
	.quit
End With 'IE
Set IE = Nothing

Open in new window

0
Comment
Question by:travisjbennett
  • 7
  • 6
  • 4
17 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35113827
0
 
LVL 46

Expert Comment

by:aikimark
ID: 35114297
@Sid

This is a VBScript environment.
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 35115435
Sid, I'm about to get to work. I'm a little confused though by your last post: (what) is a VBScript environment?

The code of your first post?
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 1

Author Comment

by:travisjbennett
ID: 35115791
I tried the code below after clearing my history. Microsoft.com still got added to my history list.

At the bottom of your second link, in community content, it says that this flag won't keep a site from getting added to the main history list.
Option Explicit 
Const navNoHistory = &h0002
Dim IE 
Set IE = wscript.createobject("internetexplorer.application","IE_") 
With IE
	.visible = False
	.navigate "http://www.microsoft.com/", CLng(navNoHistory)
	while (.busy)    'wait until the site gets loaded 
		wsh.sleep 400
	wend
	while (.ReadyState = 4) 'ReadyState_Complete
		wsh.sleep 400
	wend
	'IE.visible = True 'Commented to continue hiding
	.quit
End With 'IE
Set IE = Nothing

Open in new window

0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35115812
@aikimark: Yes I know it is vbscript :)

@travisjbennett: You have defined the constant incorrectly. I just tried this and it works.

Option Explicit
Const navNoHistory = &H2

Dim IE
Set IE = wscript.CreateObject("internetexplorer.application", "IE_")

With IE
    .Visible = True
    .navigate "http://www.rediff.com/", navNoHistory
    While (.busy)    'wait until the site gets loaded
        wsh.sleep 400
    Wend
End With

Open in new window


Sid
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35115824
travis: Seems I spoke to soon. I just tried it with a different URL and it got added. Lemme check.

Sid
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35115841
Yes you are right. I read the community comment in this link as well.

http://msdn.microsoft.com/en-us/library/aa768360%28VS.85%29.aspx

Seems like that flag doesn't work. Dunno why MS put it then.

Sid
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 35115852
I think that flag has to do with the back & forward buttons...
if that page (or maybe the preceeding page that the browser was on before the command?) is accessible with back and forward.

Any other ideas, or maybe a seperate script or something that could do it? I do not want to use MS Access here.
0
 
LVL 46

Expert Comment

by:aikimark
ID: 35116096
If the browser is IE8, the documentation states that you can use the -private command line switch.

http://msdn.microsoft.com/en-us/library/ee330728(v=vs.85).aspx

=======
You might choose to clear the history at the end of your process.
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

Open in new window


http://www.howtogeek.com/howto/windows/clear-ie7-browsing-history-from-the-command-line/

=======
You might consider using a different browser (not IE)
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 35116098
I mentioned my browser, but only in the question tags. I am limited to IE7.
0
 
LVL 46

Expert Comment

by:aikimark
ID: 35116118
Can you tolerate any browser history entries?  If so, you might be able to display the content of the actual web site from a neutral web site (within a frame).

Is the site always going to be the same site?

======
What problems are you trying to circumvent by preventing a browser history entry?  Knowing the context of the problem might be helpful to the participating experts.
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 35116157
I need to pass a plaintext password in the URL. The password is very sensitive.

I can't put it in a frame of a page hosted anywhere other than localhost. I cannot tolerate any browser history entries that would include the URL with the password in it, encrypted or not.
0
 
LVL 46

Accepted Solution

by:
aikimark earned 2000 total points
ID: 35116321
Since the password is sensitive, you shouldn't send it in an unencrypted form unless you are using SSL.  In your case, encrypt the password with a salt and then convert it into Base64 format.  Make sure the salt changes with each use.

WARNING:
Since this is a VBScript, please be aware that your script will likely include a plain text copy of the password.
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 35140988
Aikimark,

You're right -- I had forgotten about packet sniffing. The server doesn't currently offer SSL, but I'll be waiting for it to do so.

When it does, do the URLs of SSL pages get stored in the IE7 history?
0
 
LVL 46

Expert Comment

by:aikimark
ID: 35142135
@travisjbennett

I think we ought to start with the requirements and see if there are ways to achieve what you want.  For instance, there are applications, such as Putty, that provide secure TCP/IP communication.
0
 
LVL 1

Author Comment

by:travisjbennett
ID: 35142202
There's actually not a way to do this, and I can't really go into the details for security reasons. For example, I've already had to change my password after sending it out over the network as plaintext.

I can award you the points for the right answer though. Thanks for the slap on the back of the head (I deserved it)!
0
 
LVL 46

Expert Comment

by:aikimark
ID: 35142253
@travisjbennett

While I appreciate the points, I disagree with your conclusion that there's "not a way to do this".  Good luck with this problem.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question