Is there a way to detect, that my application is currently running on the Ripple Emulator, instead of a real device? I want some workaround code to be ran only on the emulator.
You need to check the userAgent
property in navigator
object and check for a ripple instance on your DOM with window.parent.ripple
. Ripple-Emulator is a browser
userAgent. Maybe you going to add firefoxOS. :)
//check if the application is running on a mobile device or desktop
if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/)
&& !window.parent.ripple) {
app.deviceType = 'mobile';
} else {
app.deviceType = 'browser';
}