Get out of IE6

Problem this snippet solves:

Description: https://devcentral.f5.com/weblogs/Joe/archive/2009/02/24/help-users-get-out-of-the-stone-age-with-irules.aspx

Related Article

http://news.bbc.co.uk/2/hi/technology/8488751.stm

Code :

when RULE_INIT {
  # replace the value of the _uacct variable with your Google Analytics account.
  set static::warnie6 ""
}
when HTTP_REQUEST {
  # Don't allow data to be chunked
  if { [HTTP::version] eq "1.1" } {
    if { [HTTP::header is_keepalive] } {
       HTTP::header replace "Connection" "Keep-Alive"
    }
    HTTP::version "1.0"
  }
}
when HTTP_RESPONSE {
  if { [HTTP::header Content-Type] starts_with "text/html" } {
    if { [HTTP::header exists "Content-Length"] } {
      #log local0. "content length: [HTTP::header {Content-Length}]"
      set content_length [HTTP::header "Content-Length"]
    } else {
      set content_length 1000000
    }
    #log local0. "Collecting $content_length bytes"
    if { $content_length > 0 } {
       HTTP::collect $content_length
    }
  }
}
when HTTP_RESPONSE_DATA {
  #log local0. "Content Type: [HTTP::header Content-Type]"
  set idx [string first "" [HTTP::payload]]
  if { -1 == $idx } {
    set idx [string first "" [HTTP::payload]]
  }
  #log local0. "html body tag found at $idx"
  if { -1 == $idx } {
    set idx 0
  } else {
    incr idx 6
  }
  HTTP::payload replace $idx 0 $static::warnie6
}
Published Mar 18, 2015
Version 1.0
No CommentsBe the first to comment