Ticket #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: | ||
| Blocking: | Blocked by: |
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
Change History
comment:1 Changed 16 months ago by dmethvin
- Owner set to andrew.harland@…
- Status changed from new to pending
comment:2 Changed 16 months ago by andrew.harland@…
- Status changed from pending to new
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>
comment:3 Changed 16 months ago by anonymous
Tried it on my iPhone 3GS with iOS 5 and iPhone simulator with iOS 4, and I got both alerts.
- sindresorhus
comment:4 Changed 16 months ago by rwaldron
- Status changed from new to closed
- Resolution set to worksforme
I also tested this on my iPhone 4S - no issues.
comment:5 Changed 2 months 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 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.
comment:6 Changed 2 months 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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

We just need a few things before we can investigate.
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.