Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Add Trident token documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
pnelson committed May 27, 2014
1 parent 1a95482 commit 1b43b06
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func (p *UserAgent) detectBrowser(sections []UASection) {
if comment[0] == "compatible" && strings.HasPrefix(comment[1], "MSIE") {
p.browser.engine = "Trident"
p.browser.name = "Internet Explorer"
// The MSIE version may be reported as the compatibility version.
// For IE 8 through 10, the Trident token is more accurate.
// http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx#VerToken
for _, v := range comment {
if strings.HasPrefix(v, "Trident/") {
switch v[8:] {
Expand All @@ -84,6 +87,7 @@ func (p *UserAgent) detectBrowser(sections []UASection) {
break
}
}
// If the Trident token is not provided, fall back to MSIE token.
if p.browser.version == "" {
p.browser.version = strings.TrimSpace(comment[1][4:])
}
Expand Down

0 comments on commit 1b43b06

Please sign in to comment.