Skip to content

Instantly share code, notes, and snippets.

@triceam
Created January 28, 2013 18:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triceam/4658021 to your computer and use it in GitHub Desktop.
Save triceam/4658021 to your computer and use it in GitHub Desktop.
Detecting PhoneGap/Ripple emulator via JavaScript
myFunction( param ) {
var emulated = window.tinyHippos != undefined;
if ( emulated ){
//do something specific to emulated environment;
return;
}
///do something else...
}
@jerone
Copy link

jerone commented Jan 28, 2013

I used this for older versions:

// check if we are in Ripple Emulator;
var emulated = !!document.getElementById("tinyhippos-injected") && !!window.top.require;

@sgrebnov
Copy link

I think the following code could be used as well

var emulated = window.parent && window.parent.ripple;

@slorber
Copy link

slorber commented Oct 23, 2014

thanks it works fine :) sgrebnov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment