Twitter: raymondcamden

Address: Lafayette, LA, USA

Quick Ripple Tip - Detecting Ripple

01-22-2014 3,639 views Mobile 1 Comment

This was asked on the Ripple development listserv:

For debugging purposes, I'd like to do different things when I am using ripple, than when I am running Phonegap on my phone. Is there an easy way to tell, if I am in Ripple?

Gord Tanner replied that you can look for window.parent.ripple. He said he hadn't tested it but I ran a quick test and it worked fine (it existed in Ripple and did not exist in the iOS simulator).

In general writing code like this concerns me as it smells like the type of thing you can forget to remove in production, but we've all done stuff like this before (including myself) so there ya go. ;)

By the way, information about how to sign up for the mailing list can be found here:

1 Comment

  • Val #
    Commented on 01-22-2014 at 12:24 PM
    The script that Ripple itself injects into pages is checking it like this:
    if ( { ... }

    The other way to check if Ripple if there, which is rather funny:
    if (window.tinyHippos) { ... }

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty