Intercepting Hyperlinks in HTML Component of Adobe AIR

by

AIR’s HTML control provides an easy way to render complex html content. It also gives user flexibility in manipulating events and data it contains. For instance, one can easily react to a hyperlink click in an html document.
Consider the following html snippet:

 

var str:String = ‘Go to <a href=”google.com” id=”linkGoogle”>google</a>’;
html.data = str; // html is of type HTML…

When a user clicks on “google” link, by default, the HTML control will navigate away from the current page and go to google.com. Let’s assume that we’d like to do something different. Let’s say we want to display a native AIR dialog box (called GoogleDialog) that has a text field to accept keywords to search, Search button and Cancel button.