Quick Ripple Tip - Detecting Ripple

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: http://ripple.incubator.apache.org/#mailinglist.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments