Solved

.VBS VBScript to Launch URL & NOT add to history

Posted on 2011-03-11
17
1,481 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 45

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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 45

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 45

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 45

Accepted Solution

by:
aikimark earned 500 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 45

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 45

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now