Prevent Javascript error when using a UA spoofer