IE Com 对象,方法 .Navigate 和 .Navigate2 之间的区别 [英] IE Com Object, Difference between methods .Navigate and .Navigate2
问题描述
$ie.Navigate("URL")
和$ie.Navigate2("URL")
有什么区别?
获取会员 说:
Navigate Method void Navigate (string, Variant, Variant, Variant, Variant)Navigate2 方法 void Navigate2 (Variant, Variant, Variant, Variant, Variant)
示例代码:
$ie = New-Object -ComObject InternetExplorer.Application$ie.visible = $true$ie.Navigate("www.stackoverflow.com")#或者$ie.Navigate2("www.stackoverflow.com")
区别在于第一个参数URL
.这是 MSDN 所说的:
URL:一个字符串表达式,计算为要显示的资源的 URL、完整路径或通用命名约定 (UNC) 位置和名称.
URL:一个变量或表达式,用于计算要显示的资源的 URL、文件位置的完整路径或表示 Shell 命名空间中的文件夹的 PIDL.
...
此方法扩展了 Navigate 方法以允许 Shell 集成;但是,此方法不会使 Navigate 过时.原始方法仍可用于 URL 导航.
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")
The difference is in the first argument URL
. Here is what MSDN says:
URL: A String expression that evaluates to the URL, full path, or Universal Naming Convention (UNC) location and name of the resource to display.
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.
这篇关于IE Com 对象,方法 .Navigate 和 .Navigate2 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!