IE Com 对象,方法 .Navigate 和 .Navigate2 之间的区别 [英] IE Com Object, Difference between methods .Navigate and .Navigate2

查看:77
本文介绍了IE Com 对象,方法 .Navigate 和 .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) 位置和名称.

Navigate2 方法p>

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:

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.

这篇关于IE Com 对象,方法 .Navigate 和 .Navigate2 之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆