#6724 closed bug (cantfix)
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"
Change History (29)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Same problem here, used the same workaround. Seems to be a problem on iPad as well.
comment:3 Changed 13 years ago by
Owner: | set to 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?
comment:5 Changed 13 years ago by
Status: | pending → closed |
---|
Automatically closed due to 14 days of inactivity.
comment:6 follow-up: 7 Changed 12 years ago by
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.
comment:7 Changed 12 years ago by
Replying to 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
comment:9 follow-up: 10 Changed 12 years ago by
I am finding the same issue, can the ticket be re-opened?
comment:10 Changed 12 years ago by
Replying to 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.
comment:11 Changed 11 years ago by
I was able to duplicate this by first scrolling up to hide the iphone address bar. After that
$(window).height() != window.innerHeight
comment:13 Changed 11 years ago by
This is still happening on the iPhone 4 with the latest version of JQM. The fix stated at the top works still.
comment:14 Changed 11 years ago by
Still happening on iPad and iPhone on IOS 5 with jQuery 1.7.1.
Use window.innerHeight and window.innerWidth instead.
comment:15 Changed 11 years ago by
$(window).height gives screensize on iOS, not innerHeight. tested JQ 1.7.1
use var winheight= window.innerHeight ? window.innerHeight:$(window).height();
as workaround
comment:16 Changed 11 years ago by
Sounds like $(window).height(); returns screen's height minus address bar (minus Debug Console bar if activated).
comment:18 Changed 11 years ago by
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.
comment:20 Changed 11 years ago by
Hm. Might be worth noting here that we have an active pull request for this.
comment:21 Changed 11 years ago by
Keywords: | mobile window height removed |
---|---|
Milestone: | → 1.8 |
Priority: | undecided → low |
Status: | reopened → open |
comment:22 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #6724, though the Mobile Safari wound remains. Closes gh-764.
Changeset: ca48d490407b198e022b0d0294a7493602155f74
comment:24 Changed 11 years ago by
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.
comment:25 Changed 11 years ago by
See the discussion here: https://github.com/jquery/jquery/pull/764
comment:27 Changed 10 years ago by
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.
comment:28 Changed 10 years ago by
Resolution: | → cantfix |
---|---|
Status: | reopened → closed |
comment:29 Changed 9 years ago by
I think this is the solution for this bug.
http://viralpatel.net/blogs/jquery-window-height-incorrect/
my current workaround:
height = window.innerHeight ? window.innerHeight : $(window).height()