Use the event "BeforeNavigate2" of the WebBrowser control: "Occurs when the WebBrowser control is about to navigate to a different URL, which may happen as a result of external automation, internal automation from a script, or the user clicking a link or typing in the address bar. The container has an opportunity to cancel the pending navigation. " (taken from Microsoft MSDN)
Code:
//Initialize
var var1 = createControl("Shell.Explorer.2", 0, 0, 400, 400);
var webctrl = var1.activex;
webctrl.navigate2("http://www.swfkit.com");
webctrl.beforeNavigate2 = function (obj, url, flags, target_frame, postdata, headers, cancel)
{
Dialogs.msgBox(url + " clicked!");
trace(obj);
trace(url);
trace(flags);
trace(target_frame);
trace(postdata);
trace(headers);
trace(cancel);
}
return true;
//The code works well in SWFKit 1.05, it has not been tested in SWFKit 1.0. SWFKit 1.05 will come out in this week. SWFKit 1.05 is case insensitive for the names of methods and properties of ActiveX controls.