Log in

View Full Version : Change skin based on browser.


bnji
01-05-2012, 03:42 PM
Hi, I need a way to change the style on my forum based on the browser being used.
Our default skin uses certain things that Internet Explorer doesn't support, so I'd like to make any version of IE default to a different style.

Thanks.

HMBeaty
01-05-2012, 04:51 PM
Try this..... create a plugin with the hook location style_fetch and add this code into it
if (is_browser('ie'))
{
$styleid = x;
}
And obviously change the x to the styleid that you want to restrict to IE :)

bnji
01-05-2012, 10:56 PM
Try this..... create a plugin with the hook location style_fetch and add this code into it
if (is_browser('ie'))
{
$styleid = x;
}
And obviously change the x to the styleid that you want to restrict to IE :)

Works perfectly, thank you! :)
If I wanted to default mobile browsers to my mobile style, would I be able to use this like
if (is_browser('ie'))
{
$styleid = x;
}
if (is_browser('mobile useragent string here'))
{
$styleid = x;
}
or would I have to make a second plugin?
It's not a necessity but it'd be really handy!

HMBeaty
01-06-2012, 02:50 AM
Not sure if this will work or not, but in the same plugin, add this:
global $mobile_browser;
if ($mobile_browser)
{
$styleid = x;
}