FreiChat related discussions
Disabling Freichat for mobile

I am pretty new to Freichat, but am really enjoying its simplicity and functionality. Nice addition to my Joomla25/JomSocial site. However, my mobile users are complaining that it takes up too much space on the screen and so I would like to disable it entirely if the user is mobile. There is no setting for this, so I realize I have to hack the code a bit. I tried the obvious in client/main.php, using the $mobile variable that is supposed to be set up at the top of the file. However, I find that that variable is always zero, regardless of browser device. So, is there another way to prevent Freichat from loading on mobile devices?

I am using a Bootstrap-based template, if that helps, but judging by the way the Joomla module loads the chat code, I suspect not.

Thanks, in advance, for any advice or help.

-- tomo

I am pretty new to Freichat, but am really enjoying its simplicity and functionality. Nice addition to my Joomla25/JomSocial site. However, my mobile users are complaining that it takes up too much space on the screen and so I would like to disable it entirely if the user is mobile. There is no setting for this, so I realize I have to hack the code a bit. I tried the obvious in client/main.php, using the $mobile variable that is supposed to be set up at the top of the file. However, I find that that variable is always zero, regardless of browser device. So, is there another way to prevent Freichat from loading on mobile devices? I am using a Bootstrap-based template, if that helps, but judging by the way the Joomla module loads the chat code, I suspect not. Thanks, in advance, for any advice or help. -- tomo

Go to freichat/client/main.php

Replace

if ($cvs->BOOT == "no") {

//Do not load freichat
exit;
}

with
$user_agent = strtolower ( $_SERVER['HTTP_USER_AGENT'] );
$mobile = 0;
if ( preg_match ( "/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|iemobile|windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|samsung|sonyericsson|^sie-|nintendo/", $user_agent ) )
{
$mobile = 1;
}

if ($cvs->BOOT == "no" || $mobile == 1) {

//Do not load freichat
exit;
}

Go to freichat/client/main.php Replace <code>if ($cvs->BOOT == "no") { //Do not load freichat exit; }</code> with <code> $user_agent = strtolower ( $_SERVER['HTTP_USER_AGENT'] ); $mobile = 0; if ( preg_match ( "/phone|iphone|itouch|ipod|symbian|android|htc_|htc-|palmos|blackberry|opera mini|iemobile|windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|samsung|sonyericsson|^sie-|nintendo/", $user_agent ) ) { $mobile = 1; } if ($cvs->BOOT == "no" || $mobile == 1) { //Do not load freichat exit; }</code>
Necessity is the mother of all inventions!
81
2
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft