Forum Moderators: coopster
Mozilla/5.0 (Windows NT 6.0; rv:8.0) Gecko/20100101 Firefox/8.0
one thing you could try which wont filter firefox but other than internet explorer is have a div in which your share buttons are and hide it in the css.
<?php
$browser = strpos($_SERVER['HTTP_USER_AGENT'],"Firefox");
if ($browser == true) { echo ' '; }
else
include("../includes/social-middle_templates.php");?>
Unless I am mistaken, most of tools used by G. to measure the page load time are directly depending on firefox browser therefor, if your page load was 3.5s after using the script above will be something like 1.4 - 1.7s.
$browser = strpos($_SERVER['HTTP_USER_AGENT'],"Firefox");
if ($browser == true) { echo ' '; }
if ($browser !== false) { echo ' '; }
$ua=get_server('HTTP_USER_AGENT');
$isFirefox = ( $ua!=false && strpos($ua,"Firefox")!=false );
# get $_SERVER variables
# protected against throwing warnings
function get_server($var) {
$value=false;
if( isset( $_SERVER[$var] ) )
$value=$_SERVER[$var];
return($value);
}
# get parameters passed by POST or GET
# protected against throwing warnings
function get_parm($var) {
$value=false;
if( isset( $_REQUEST[$var] ) )
$value=$_REQUEST[$var];
return($value);
}
function get_parm($var) {
return isset($_REQUEST[$var]) ? $_REQUEST[$var] : false;
}
In this case, the code he doesn't want to keep repeating is a check to see if the variable "isset" before fetching the value.
And if you like pretty functions, this could be rewritten to not use a placeholder
PHP Notice: Undefined index: HTTP_USER_AGENT in /var/www/vhosts/example.com/httpdocs/index.html on line 36
if (!empty($_SERVER['HTTP_USER_AGENT']))
if (isset($_SERVER['HTTP_USER_AGENT']))
...this error keeps coming up and, I do not know if you have noticed, only on one single page of the site.