foregroundBrowser - web automation property

Returns a web automation library Browser object attached to foreground Internet Explorer instance (the IWebBrowser2 with which the user is currently working).

Applies to:
Core
  var b = coreObj.foregroundBrowser;
Arguments:
None.
Remarks:
The property is null if no Internet Explorer browser is in foreground. The property returns a web automation Browser object that matches the search condition arguments and gets programmatic control over the IWebBrowser2 underlying IE native object. This IE automation property works for all Internet Explorer versions: IE6, IE7, IE8, IE9 and with IE protected mode on Windows XP, Vista and Win7.
Example:
// Make the foreground browser to navigate; start a new browser if there is no browser in foreground.
var coreObj = new ActiveXObject("Twebst.Core");
var b       = coreObj.foregroundBrowser;

if (b == null)
{
	// No foreground browser.

	b = coreObj.StartBrowser("http://www.codecentrix.com/");
}
else
{
	b.Navigate("http://www.codecentrix.com/");
}
		
See also:
Browser | Core | FindBrowser | StartBrowser

© 2014 CodeCentrix Software. All rights reserved.