Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
959 views
in Technique[技术] by (71.8m points)

internet explorer - IE Com Object, Difference between methods .Navigate and .Navigate2

What is the difference between $ie.Navigate("URL") and $ie.Navigate2("URL")?

Get-Member says:

Navigate       Method    void Navigate (string, Variant, Variant, Variant, Variant)  
Navigate2      Method    void Navigate2 (Variant, Variant, Variant, Variant, Variant)

Sample Code:

$ie = New-Object -ComObject InternetExplorer.Application
$ie.visible = $true

$ie.Navigate("www.stackoverflow.com")
#or
$ie.Navigate2("www.stackoverflow.com")
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The difference is in the first argument URL. Here is what MSDN says:

Navigate Method

URL: A String expression that evaluates to the URL, full path, or Universal Naming Convention (UNC) location and name of the resource to display.

Navigate2 Method

URL: A variable or expression that evaluates to the URL of the resource to display, the full path to the file location, or a PIDL that represents a folder in the Shell namespace.

...

This method extends the Navigate method to allow for Shell integration; however, this method does not make Navigate obsolete. The original method can still be used for URL navigations.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...