HTML_TAG_MATCHED¶
Description¶
The HTML_TAG_MATCHED event is raised when an HTML tag is encountered
in a document and there is a rule attached to the HTML profile that
says to raise an event on matching tag with the specific tag name and
optionally the specific attribute name and value.
Examples¶
when HTTP_REQUEST {
set uri [HTTP::uri]
HTTP::header replace "Host" "finance.yahoo.com"
}
when HTTP_RESPONSE {
if { $uri equals "/" } {
HTML::enable
} else {
HTML::disable
}
}
when HTML_TAG_MATCHED {
log local0. "element = [HTML::tag name]"
log local0. "attribute id = [HTML::tag attribute id]"
switch [HTML::tag name] {
"form" {
if { [HTML::tag attribute "id"] equals "quote" } {
set inject_js 1
}
}
"/form" {
if { [info exists inject_js] && $inject_js == 1 } {
unset inject_js
HTML::tag append "<scr"
HTML::tag append "ipt>"
HTML::tag append "function submitForm() {"
HTML::tag append " document.quote.s.value='FFIV';"
HTML::tag append " document.quote.submit();"
HTML::tag append "}"
HTML::tag append "setTimeout('submitForm()', 5000);"
HTML::tag append "</script>"
}
}
}
}