Support » Plugin: Shadowbox JS » Shadowbox JS on Mobile devices

  • 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 I added the code to my theme functions.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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Martz


    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.

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shadowbox JS on Mobile devices’ is closed to new replies.