WP plugin based on useragent
Posted
by jake
on Stack Overflow
See other posts from Stack Overflow
or by jake
Published on 2010-05-11T23:02:18Z
Indexed on
2010/05/11
23:04 UTC
Read the original article
Hit count: 385
I am writing a plugin which does some js stuff, but does not work for other browsers than FF . I've thought why not execute the plugin for the browsers which support it. I've added the code, but for some reason when I activate the plugin and check the site with a FF all I get is blank page. If I visit with a IE the site is shown correctly. Basically my code is like this
$agent= strtolower($_SERVER['HTTP_USER_AGENT']); if (preg_match('/firefox/',$agent)){ include(plugins_url('script.js',FILE)); some more code }
So when I visit with FF I get blank page, when I visit with IE the blog loads normally
© Stack Overflow or respective owner