WordPress.org

Ready to get started?Download WordPress

Forums

Shadowbox JS
Shadowbox JS on Mobile devices (3 posts)

  1. invision-studios
    Member
    Posted 1 year ago #

    I'm in the process of converting an existing site to a responsive version in WP 3.51. I've installed Shadowbox JS to play videos in a modal window, and it works beautifully in desktop browsers. I've run into a small snag: the plugin displays "You must install the Flash browser plugin to view this content" on mobile browsers.

    No big deal for iOS devices. Using your suggestion here http://wordpress.org/support/topic/plugin-shadowbox-js-is-it-possible-to-disable-shadowbox-for-iphoneipad I added the code to my theme functions.php:

    <?php
    	global $is_iphone;
    	if ( $is_iphone ) {
    		add_filter('shadowbox-js', '__return_false');
    	}
    ?>

    which forces iOS devices to launch the YouTube player. So far so good.

    However, when testing on an Android device simulator, I get the same error. I have to admit I'm clueless about Android -- does it come with a YouTube app like the iPhone? And/or is there a way to force the browser to play the MP4 version of the video?

    I see your little code snippet uses the "$is_iphone" global from WP vars.php. Is there a similar global var for Android? The closest thing I see is "$is_chrome" - wondering what the Useragent is for Droid.

    Any assistance you can give is greatly appreciated.

    http://wordpress.org/extend/plugins/shadowbox-js/

  2. Matt Martz
    Member
    Plugin Author

    Posted 1 year ago #

    Instead of using $is_iphone, you can utilize the wp_is_mobile() function such as:

    if ( wp_is_mobile() ) {
            add_filter('shadowbox-js', '__return_false');
    }

    IIRC wp_is_mobile was added in WP 3.4.

  3. jeffreyeric
    Member
    Posted 7 months ago #

    Hi Matt,

    Thanks for this tip. However, I can verify that the conditional statement is working but the filter is not.. I can echo some text that i only see on a mobile device so i can say that the statement is working.. But, for some reason shadowbox is still working.. What am i missing? I've added this filter ABOVE

     <?php wp_head(); ?> 
    is that the correct placement?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic