views:

125

answers:

1

I'm working on a word press project. I noticed that rss is not working fine on google chrome. After I googled about it, it turned out that I need to install a plugin for google chrome so rss works. I want to know how to detect if the plugin is installed or not in case the user is using chrome browser. Currently I'm doing the following:

function is_chrome() { return(eregi("chrome", $_SERVER['HTTP_USER_AGENT'])); }

if(is_chrome()) { // I want to check if plugin installed or not here.

}

+1  A: 

You cannot detect browser plugins via PHP. You need to use JavaScript and then call a PHP script with an argument telling it if the JavaScript detected the plugin or not.

Additionally, DO NOT use ereg/eregi at all - use preg_match if you need regular expressions. However, regular expressions are overkill for a "string a in string b" check. Use this instead:

function is_chrome() {
    return stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false;
}
ThiefMaster
what is the name of the plugin that I'm supposed to check about on java script?
zeina