On mobile devices and iPad the fixed position of the chat don't works properly.
Also the Long Polling and the ajax method has some problems.
In my case I decide to disallow drupalchat on mobile devices.
This is my patch

Comments

darklrd’s picture

Thanks for your patch!

I have a query. Will this work for all mobile devices? Is there a more generic function for this (maybe a Drupal function)?

thermador’s picture

Can this get added as a feature for the next version? Like just a checkbox in the DrupalChat settings "disable DrupalChat on mobile devices". Please???

(Try using DrupalChat on a mobile device... it's not possible to fully use the functionality, and it wrecks the site theme.)

The code is already here in this patch; it would be easy to implement.

(I am using the D7 version but it should be added to both.)

Thank you!

darklrd’s picture

The question still remains, is this function generic?

You can use visibility control to stop drupalchat on mobile specific URLs.

thermador’s picture

The question still remains, is this function generic?

Probably not generic enough: It only includes user agents for iphone, ipad, and android:

if(stripos($_SERVER['HTTP_USER_AGENT'],"iPod") || stripos($_SERVER['HTTP_USER_AGENT'],"iPhone") || stripos($_SERVER['HTTP_USER_AGENT'],"iPad") || stripos($_SERVER['HTTP_USER_AGENT'],"Android")) {

There are a LOT of other mobile user agents out there. These would have to be added to the function, and then be updated every time there was a new mobile device.

So... I did some research on my own.

This is what I did to solve the problem. Maybe it can be worked into a DrupalChat option?

I added this code to the main CSS for my site. This solution is tested and working for me.

/* #### Old Handheld Devices #### */
@media handheld {
DIV#drupalchat-wrapper { display: none; }
}

/* #### Mobile Phones Portrait #### */
@media screen and (max-device-width: 480px) and (orientation: portrait){
DIV#drupalchat-wrapper { display: none; }
}

/* #### Mobile Phones Landscape #### */
@media screen and (max-device-height: 480px) and (orientation: landscape){
DIV#drupalchat-wrapper { display: none; }
}

/* #### Mobile Phones Portrait or Landscape #### */
@media screen and (max-device-width: 640px){
DIV#drupalchat-wrapper { display: none; }
}

/* #### iPhone 4+ Portrait or Landscape #### */
@media screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2){
DIV#drupalchat-wrapper { display: none; }
}

/* #### Tablets Portrait or Landscape #### */
@media screen and (min-device-width: 768px) and (max-device-width: 1024px){
DIV#drupalchat-wrapper { display: none; }
}

Based on what I've read here: http://www.javascriptkit.com/dhtmltutors/cssmediaqueries2.shtml

Exploratus’s picture

Much needed!

darklrd’s picture

You can now use URL visibility control (present on DrupalChat configuration page). Thanks.

andrea.failli’s picture

Version:6.x-2.0-beta9» 6.x-2.0-beta19
Assigned:Patrizio» Unassigned
Status:Needs review» Patch (to be ported)
StatusFileSize
new3 KB

Thank you for the URL visibility control feature. But on my website, the mobile version is on a different domain: the page paths are the same for the PC version and mobile version, so I can't disable the chat on the mobile version.
I've patched the module...with this patch you can configure under which domain enable/disable the chat.
Hope this help!

Andrea