Recommend using:

imageUrl.substr(0, 5) != "data:"

which may be faster on some devices considering data URI strings can be quite long.