Added check so that the alert won't fire in the browser.

Thanks for letting me know about this, @molily.