Is there a plugin which disables other plugins for mobile browers?

I have a wordpress site which uses a plugin to provide a music player. This plugin uses frames to keep the music playing while the user browses the site.

Mobile devices have trouble with this because of the frames. When I disable the plugin then the mobile devices view the site fine.

Read More

I want to disable this plugin for anyone viewing the site on a mobile device.

Ideally I want to do this without writing any code, just using something that already exists.

Thanks!

Related posts

Leave a Reply

3 comments

  1. This question is borderline within (if at all) the scope of WPSE as per the newly committed change to the FAQ.

    If done “with code”, the easiest would be to employ css media queries to hide the frame (or parent element) by its class or id.

    For the sake of completeness, there is a WP core function that attempts to check for mobile devices – but that employs user agent sniffing and is hence not to be trusted as far as reliability is concerned (one of the few core functions not recommendable to use, imho).

    Also for the sake of completeness only, there’s the deactivate_plugins() core function. It also has a companion, activate_plugins(). deactivate_plugins() has a $silent (boolean) parameter, that prevents deactivation hooks from firing (i.e. database entries that would otherwise be deleted won’t be lost). Hence you could execute either on the condition of what device your site is loaded on, but that would for one not be very efficient and for another I wouldn’t know of any reliable server-side way of detecting the device.

    Also what is a mobile device?
    Several generations of smartphones, tablets, netbooks, laptops, desktops, TV Screens and a huge variety of pixel densities (the “Retina” screen wasn’t the first one to go past 96ppi…).
    –> The only reliable way of designing for different devices is via screen size and pixel density. And that’s information you cannot gather server-side. And since you can’t, you can’t disable plugins based on it.

    So here we are at either css or js.
    Either way, media queries are it.

  2. Do not disable the plugin, rewrite it to load the iframe on wide viewports only instead. Here is a sample code showing how that could be done.

    As Johannes has explained, there is no way to detect a mobile device on the server side, and some mobile devices have a better resolution and internet connection than some other devices that are not seen as mobile.

  3. I’m about 95% sure that either WPTouch, or the Pro version of that plugin allows you to disable plugins for mobile users. But I don’t know if it allows you to ONLY disable the plugins and still display your normal site… or if it forces you to use a mobile theme.

    [edit]
    Reading from the free version of plugin documentation and code:

    Restricted Mode
    Disallow other plugins from loading scripts into WPtouch’s header and footer. Sometimes fixes incompatibilities and
    speeds up WPtouch.

    This mode removes wp_head() and wp_footer() when displaying the mobile version. And it will block other scripts from loading, but not necessarily will block everything from another plugin’s behavior.