Skip to main content

Bug Tracker

Side navigation

#11206 closed bug (worksforme)

Opened January 22, 2012 04:07PM UTC

Closed January 22, 2012 11:44PM UTC

Last modified March 13, 2013 09:00PM UTC

jQuery 1.6.2 and greater is not supported on Safari on iPhone

Reported by: andrew.harland@hotmail.co.uk Owned by: andrew.harland@hotmail.co.uk
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Hi, I've had to roll back to version 1.4.2 to get simple jQuery functions working on an iPhone.

When testing on 1.6.2 and the latest release 1.7.1, even a simple alert does not work. I half suspect this is as designed (so as to promote jQuery mobile), but as I can't find any documentation I thought I'd let you know.

Regards

Attachments (0)
Change History (6)

Changed January 22, 2012 04:16PM UTC by dmethvin comment:1

owner: → andrew.harland@hotmail.co.uk
status: newpending

We just need a few things before we can investigate.

  • What version of the iPhone?
  • What does your test case look like? Please post it on jsFiddle.net.
  • Are you saying your test succeeds when you include jQuery Mobile, with no other changes to the test case?

Also, if you can't find any documentation, it's best to first ask for help on http://forum.jquery.com or Stackoverflow to ensure you haven't missed something.

Changed January 22, 2012 04:44PM UTC by andrew.harland@hotmail.co.uk comment:2

status: pendingnew

It was tested on a 3GS and iPhone 4 (not 4S).

No, I didn't test using JQM. The original script was a slideshow, which I reduced to a simple alert for debugging:

<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>

// worked on all desktop browsers and android, but not on iPhone
<script type="text/javascript">
    $(document).ready(function() {
    alert('jQuery alert');
});
</script>

// worked on all browsers and iPhone
<script type="text/javascript">
    alert('JavaScript alert');
</script>

Changed January 22, 2012 11:24PM UTC by sindresorhus comment:3

_comment0: [http://jsfiddle.net/mofle/wD94v/ jsfiddle] \ \ Tried it on my iPhone 3GS with iOS 5 and iPhone simulator with iOS 4, and I got both alerts.1327274739665972
_comment1: [http://jsfiddle.net/mofle/wD94v/ jsfiddle] \ \ Tried it on my iPhone 3GS with iOS 5 and iPhone simulator with iOS 4, and I got both alerts. \ \ - sindresorhus1327274825963905

jsfiddle

Tried it on my iPhone 3GS with iOS 5 and iPhone simulator with iOS 4, and I got both alerts.

It seems the issue is with your iPhone or your development setup.

  • sindresorhus

Changed January 22, 2012 11:44PM UTC by rwaldron comment:4

resolution: → worksforme
status: newclosed

I also tested this on my iPhone 4S - no issues.

Changed March 13, 2013 08:29PM UTC by christian@roy.name comment:5

I am having a very similar issue. Two iphone 4 gives different results.

I wish I could provide some information that would help reproduce the problem but... I do not know why it's behaving like this.

I made a very simple html file based on the code provided by andrew.harland and I did not get the alert on my iPhone 4 but my friend was getting it.

I simply changed the <script> line to load the jquery from google hosted apis and I was able to get the alert.

It is worth to note that the local file came from the google hosted version.

|| ||Using local file (copy of google's)|| Referencing google's version directly||

||My iphone:||no alert||alert||

||My friend's:||alert||alert||

<script src="jquery-1.6.2.min.js"></script>

vs.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

I tried multiple things like specifying the full URL on my local file and I tried specifying http: on the google one. Always same results.

I also cleared cache on my iphone and restarted it. Same results.

Changed March 13, 2013 09:00PM UTC by Andrew comment:6

It's not an issue with jQuery on iPhone. The issue is with the network (in this case O2) compressing/optimising scripts and making then unworkable. There's some discussion on the O2 forum pages about this but it's tricky to locate, but as I gather there is some code to include that tells O2 not to compress the JS. The alternative is just to link directly to a CDN hosted version.