The DisconnectObject method disconnects any event-handling connection between the currently executing script and the specified object. If a connection with the specified object was not previously established with a call to ConnectObject, CreateObject or GetObject, then this method does nothing.
objIE =
WScript.CreateObject("InternetExplorer.Application","objIE_")
objIE.Visible = true
WScript.Sleep(30000)
WScript.DisconnectObject(objIE)
function
objIE_NavigateComplete2(pDisp, URL)
{
WScript.Echo("You just navigated to",
URL)
}You
just navigated to http://www.devguru.com
You just navigated to
http://www.devguru.com/top.html
You just navigated to
http://www.devguru.com/frameset.asp
You just navigated to
http://www.devguru.com/menu.asp
You just navigated to
http://www.devguru.com/home.asp
This JScript code creates an instance of Internet Explorer and establishes an event handler for its NavigateComplete2 event. The script handles this event for 30 seconds and then disconnects from the Internet Explorer object. If the user navigates to http://www.devguru.com during this 30 second period, they will see the output shown.