Detect Rhoelements gracefully...?

Rhoelements has been working great in my test environment and I'm well on my way to building my first test application - however, I've run into an issue where when I run my webapp on the PC, I'm calling rhoelements javascript objects that aren't declared... Is there anyway we can detect if the user is using rhoelements on a device so that we can catch this and opt out of calling those rhoelements specific objects?

Thanks!

Robert Galvin
Look at the User Agent string

Look at the User Agent string. By default we include a string “MotorolaWebKit” in it. You can use this to check.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
This is taken from the Damage

This is taken from the Damage Report demo, available on the support site:

if(navigator.userAgent.match(new RegExp('MotorolaWebKit')))
{
    isRhoElements = true;
} else {
    isRhoElements = false;
}

Then you have to check for this variable whenever you want to access an object available only in RhoElements.

Take a look at the damage.js script available in the Damage Report sample app for some ideas on what you can do.

~Pietro

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments