Javascript fix for phone compatibility