Side navigation
#6724 closed bug (cantfix)
Opened June 25, 2010 03:54PM UTC
Closed February 18, 2013 07:09PM UTC
Last modified April 10, 2014 01:50PM UTC
wrong $(window).height() in mobile safari (iphone)
Reported by: | bv | Owned by: | bv |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | dimensions | Version: | 1.4.2 |
Keywords: | iphone safari | Cc: | |
Blocked by: | Blocking: |
Description
using $(window).height() in iphone's mobile safari gives wrong values
user agent:
"Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_2_1 like Mac OS X; de-de) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11 Safari/525.20"
Attachments (0)
Change History (29)
Changed June 25, 2010 03:56PM UTC by comment:1
Changed September 30, 2010 06:37AM UTC by comment:2
Same problem here, used the same workaround. Seems to be a problem on iPad as well.
Changed October 14, 2010 03:22AM UTC by comment:3
owner: | → bv |
---|---|
priority: | → undecided |
status: | new → pending |
This issue appears to be very similar to what is also being experienced in #6746 with individual elements.
Could you please provide a test case of what you're trying to do here so that we can more accurately evaluate your original ticket?
Changed November 11, 2010 11:09PM UTC by comment:5
status: | pending → closed |
---|
Automatically closed due to 14 days of inactivity.
Changed September 07, 2011 08:46PM UTC by comment:6
I ran into the exact same problem, I had to explicitly use .innerHeight when iphone. Error did not happen in newest ipad, but happens on iphone still.
Changed September 19, 2011 10:30AM UTC by comment:7
Replying to [comment:6 anonymous]:
I ran into the exact same problem, I had to explicitly use .innerHeight when iphone. Error did not happen in newest ipad, but happens on iphone still.
Same here, issue occurs on
iPhone 4 - (FW 4.3.5)
but works fine on
iPad 2 - (4.3 (8f191)
Can someone reopen the ticket please?
I cannot change the status.
Regards
Changed October 17, 2011 10:50PM UTC by comment:8
Same here in ios 5
window.innerHeight is correct
Changed November 02, 2011 09:25PM UTC by comment:9
I am finding the same issue, can the ticket be re-opened?
Changed November 02, 2011 09:32PM UTC by comment:10
Replying to [comment:9 jay.blanchard@…]:
I am finding the same issue, can the ticket be re-opened?
Never mind, it is reporting correctly - I zigged before I zagged.
Changed January 07, 2012 04:51AM UTC by comment:11
I was able to duplicate this by first scrolling up to hide the iphone address bar. After that
$(window).height() != window.innerHeight
Changed January 09, 2012 05:51PM UTC by comment:12
This happens with jquery 1.7.1. Can it be reopened?
Changed February 22, 2012 01:55PM UTC by comment:13
This is still happening on the iPhone 4 with the latest version of JQM. The fix stated at the top works still.
Changed March 27, 2012 04:01PM UTC by comment:14
Still happening on iPad and iPhone on IOS 5 with jQuery 1.7.1.
Use window.innerHeight and window.innerWidth instead.
Changed April 23, 2012 09:56PM UTC by comment:15
$(window).height gives screensize on iOS, not innerHeight. tested JQ 1.7.1
use
var winheight= window.innerHeight ? window.innerHeight:$(window).height();
as workaround
Changed April 27, 2012 02:02PM UTC by comment:16
Sounds like $(window).height(); returns screen's height minus address bar (minus Debug Console bar if activated).
Changed April 29, 2012 06:40PM UTC by comment:17
Is this addressed by #9434?
Changed April 29, 2012 08:08PM UTC by comment:18
milestone: | 1.4.3 |
---|---|
status: | closed → reopened |
Doesn't look like it. The recommendation there was for $(window).innerHeight to return $(window).height(), which returns the wrong value according to this ticket.
I'll reopen this with the faith that someone will provide both a test case and a patch. I don't have an iPhone so I can't test it.
Changed May 04, 2012 02:32PM UTC by comment:19
here's the test (this test cannot be presented in jsfiddle).
Changed May 05, 2012 03:41AM UTC by comment:20
Hm. Might be worth noting here that we have an active pull request for this.
Changed May 05, 2012 01:14PM UTC by comment:21
keywords: | iphone mobile safari window height → iphone safari |
---|---|
milestone: | → 1.8 |
priority: | undecided → low |
status: | reopened → open |
Changed May 16, 2012 06:05PM UTC by comment:22
resolution: | → fixed |
---|---|
status: | open → closed |
Fix #6724, though the Mobile Safari wound remains. Closes gh-764.
Changeset: ca48d490407b198e022b0d0294a7493602155f74
Changed June 12, 2012 04:24AM UTC by comment:23
this is not fixed.
Changed July 05, 2012 11:56AM UTC by comment:24
tested with jQuery 1.8b1 and 1.7.2 on iPhone/iOS 5.1
the issue is not fixed. jQuery is reporting the height minus the bar. when the document scrolls and the bar disappears, the height is not recalculated.
Changed July 05, 2012 01:27PM UTC by comment:25
_comment0: | See the discussion here: https://github.com/jquery/jquery/commit/ca48d490407b198e022b0d0294a7493602155f74 \ → 1341494926124436 |
---|
See the discussion here: https://github.com/jquery/jquery/pull/764
Changed February 18, 2013 01:52PM UTC by comment:26
The problem remains.
Changed February 18, 2013 07:08PM UTC by comment:27
milestone: | 1.8 |
---|---|
resolution: | fixed |
status: | closed → reopened |
If the discussion in the pull request above wasn't clear enough, we are unable to fix the issue with Safari. I will re-close this as cantfix to make that clear. You should try to convince Apple that this is a problem.
Changed February 18, 2013 07:09PM UTC by comment:28
resolution: | → cantfix |
---|---|
status: | reopened → closed |
Changed April 10, 2014 01:50PM UTC by comment:29
I think this is the solution for this bug.
my current workaround:
height = window.innerHeight ? window.innerHeight : $(window).height()