Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#11206 closed bug (worksforme)

jQuery 1.6.2 and greater is not supported on Safari on iPhone

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


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.


Change History (6)

comment:1 Changed 12 years ago by dmethvin

Owner: set to andrew.harland@…
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.

comment:2 Changed 12 years ago by andrew.harland@…

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');

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

comment:3 Changed 12 years ago by anonymous


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
Last edited 12 years ago by sindresorhus (previous) (diff)

comment:4 Changed 12 years ago by Rick Waldron

Resolution: worksforme
Status: newclosed

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

comment:5 Changed 11 years ago by christian@…

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 alertalert
My friend's:alertalert
<script src="jquery-1.6.2.min.js"></script>


<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.

comment:6 Changed 11 years ago by Andrew

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.

Note: See TracTickets for help on using tickets.