Skip to content
Browse files

RealPlayer Browser vs. plugin fix

The original REALPLAYER test looks for the presence of either the
plug-in or the browser. In order to preserve backward compatibility 
I added a new sub realplayer_browser that browser_string() uses to
identify the user agent as a RealPlayer browser. This should prevent
MSIEs with realplayer installed from being falsely identified as
Realplayer browsers.
  • Loading branch information...
1 parent 939cbbd commit 217cb1256b0f30248d4a8c6b44df08c859bc2db1 @joatis committed Jan 2, 2012
Showing with 12 additions and 3 deletions.
  1. +12 −3 lib/HTTP/BrowserDetect.pm
View
15 lib/HTTP/BrowserDetect.pm
@@ -777,12 +777,15 @@ sub _test {
$self->{realplayer_version} = undef;
if ( $tests->{REALPLAYER} ) {
- if ( $ua =~ /realplayer\/([\d\.]+)/ ) {
+ if ( $ua =~ /realplayer\/([\d+\.]+)/ ) {
$self->{realplayer_version} = $1;
my @version = split( /\./, $self->{realplayer_version} );
$major = shift @version;
$minor = shift @version;
}
+ elsif ( $ua =~ /realplayer\s(\w+)/ ){
+ $self->{realplayer_version} = $1;
+ }
}
# Device from UA
@@ -878,8 +881,8 @@ sub _realplayer_version {
}
sub realplayer_browser {
- my ( $self, $check ) = _self_or_default( @_ );
- return 1 if $self->{tests}->{realplayer_version};
+ my ( $self, $check ) = _self_or_default( @_ );
+ return 1 if $self->{realplayer_version};
return 0;
}
@@ -1483,6 +1486,12 @@ version separately.
=head3 realplayer
+=head3 realplayer_browser
+The realplayer method above tests for the presence of either the RealPlayer
+plug-in "(r1 " or the browser "RealPlayer". To preserve
+"bugwards compatibility" and prevent false reporting, browser_string calls
+this method which ignores the "(r1 " plug-in signature.
+
=head3 safari
=head3 staroffice

0 comments on commit 217cb12

Please sign in to comment.
Something went wrong with that request. Please try again.