iPhone Address Bar blocks HTML Page Header Buttons? - iphone

I have a mobile website with two header buttons. In portrait mode on iPhone it works fine. I can push the buttons.
Here is the problem:
When I switch to Portrait mode and try to tap on the buttons the native iPhone address bar shows up. It comes over the header so I cannot push the buttons.
The images show the problem:
After pushing one button you see this:
How can I prevent this problem?
Is there a way to detect i the iPhone browser bar is shown to the user?
Edit: When you use Safari whatever page you are on and turn your phone into landscape orientation and tap too much at the top of the page the address bar shows up. If you page has a fixed header bar you cannot reach it.
Edit: When I make the header position fixed then it turns out that I cannot tap the header buttons anymore when the orientation changes to landscape and the address bar shows up.
Edit: Here is a sample project which I use: http://mobilegwt.appspot.com/showcase/ You can try this on an iPhone and see the effect I showed in the images.

Maybe you should try to add the meta tag to run in full-screen mode :
<meta name="apple-mobile-web-app-capable" content="yes" />
Referenced at this link.
EDIT
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">

Have you tried adding a padding to the body? All of the fixed header designs have this. The padding to the body is equal to the height of the bar on your site that contains the icons. You can do them inside media queries if it's only on landscape:
/* iPhone 4" screen: landscape */
#media screen and (aspect-ratio: 568/114) and (device-aspect-ratio: 320/568), screen and (aspect-ratio: 568/320) and (device-aspect-ratio: 320/568) {
body {padding-top:20px} /*your padding*/
}

You can give a try add min-height to your body.
<style>
body { min-height: 505px; }
</style>
This is the source.

Related

How to get full screen mode with a mobile safari web app on IOS 8 Iphone 4S

I am very new to mobile development so please don't knock me to much for newbie questions.
I think I have the correct meta tags.
<meta name="viewport" content="width=device-width, initial-scale=1">
From apples site it said use the below tag to allow running in full screen mode but it does not seem to work.
<!-- Allow web app to be run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable"
content="yes">
Width and Height are set for Iphone 4S on IOS 8
width: 320px;
height: 480px
I can post the full code if it will help it is very simple 1 page layout header with two buttons, content just text, and a footer with nav icons
The problem as I see it is that it is not full screen and because of this the IOS navigation bar at the bottom cuts off my footer which has an icon menu
I figured it out, the meta tags are correct, you just have to create a shortcut on the home screen by clicking on the up arrow box on the bottom bar in safari and choosing add to home screen. Then launch your app and presto bars are gone. Just browsing to say 192.../yourapp does not work you have to add a shortcut to the homescreen to remove bars

StageWebView Scrolling - iOS AIR

I am using the StageWebView Class to show html pages inside my iOS app. Everything is working fine except for the scrolling. It allowing the end-user to scroll the entire webview and is showing an unsightly gray background after reaching the end of the pages content.
My question is: Is there a way to disable the scrolling past the content of the page?
I don't think there's a way to do what. The StageWebView uses the iOS default browser which implements this feature (with a different background color, the behavior is the same though).
Did you try with this viewport?
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
The important part is user-scalable=no which should remove the "scroll bounce" of the iOS browser.

How to disable bouncing in html5 fullscreen iphone app?

I want to make html5 fullscreen app. I made a page and added it as an icon to my iphone. I added metatags:
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="viewport" content="width=device-width, user-scalable=no" />
What I wanted to achieve is: black status bar on top (this does not work and I do not know why. It is still default status bar...anyone ideas?) without possibility to zoom (like in facebook app) - this works fine.
Now the problem - I can scroll on my iphone even if my app fits on the screen. It bounces back, but I dont want this behavior. I would like to disable that and enable scrolling for a particular div (.ui-content). How can I achieve that?
EDIT:
status bar is black now. It changed itself after some time. Was the previous version cached on the iphone or what?
This will prevent scrolling on the whole page
document.ontouchmove = function(e) {e.preventDefault()};
In your case, where you want some divs to be scrollable, and some not to, you should be able to catch the event before it gets to the document
scrollableDiv.ontouchmove = function(e) {e.stopPropagation()};
If your using Cordova 1.7+, open the Cordova.plist file and set the key UIWebViewBounce to NO
Extending dmanxii's approach here is what we are doing.
$("body").on("touchmove", function (event) {
if ($(event.target).is(".WhatEverClass") || $(event.target).parentsUntil().is(".ParentClass")) {
//console.log("NOT Disabled");
}
else {
//console.log("Disabled");
event.preventDefault();
}
});

iPhone full screen webpage headache

Im making a web page that has a 'fullscreen mode'. Its a normal web page until you click a button and then a div is created that has 100% height and width, and the old content is hidden. The fullscreen mode provides another button to return to non fullscreen mode, which hides the div and unhides the original content.
This works fine except that I also want to hide the browser chrome with this JavaScript method:
setTimeout(function() {
window.scrollTo(0, 1) },
100);
The JavaScript scrolls down the page enough so the browser chrome is no longer visible. The problem is this requires the page to be taller than the viewport so its able to scroll. If the content has a height of 100%, this cannot happen.
My current workaround is to to add a padding of 70px to the bottom of the fullscreen div. This works fine for the iphone, but then this unnecessary spacing is added to all devices. This may break the fullscreen effect I want in some, and creates unnecessary scroll bars in dektop browsers.
Is there a smart work around? Or do I need to detect the browser chrome height or get it from detecting the device, and add this padding accordingly?
Thanks
The best way is to write dedicated css for devices and their orientation.
You can see the media queries to detect the orientation of the devices ans set the css according to that.
<link rel="stylesheet" type="text/css" href="ipad.css" media="only screen and (min-device-width: 481px) and (max-device-width: 1024px)" />
<link rel="stylesheet" type="text/css" href="iphone.css" media="only screen and (max-device-width: 480px)" />
To hide bar use this script:
if (navigator.userAgent.indexOf('iPhone') != -1) {
addEventListener("load", function() {
setTimeout(hideURLbar, 0);
}, false);
}
function hideURLbar() {
window.scrollTo(0, 1);
}

iPhone browser adding right hand margin to some of the DIVs

This is how the site I'm putting together should look:
GB Personal Training
This is what it looks like on the iPhone:
iPhone Browser
As you can see it pushes in the #wrap and #outer-wrap DIVs, so that the background images in them have a right margin and I don't know why. I only have access to the custom.css file and not the HTML.
I'm currently editing a clone of it at:
gbptclone.live.subhub.com/
Define max-width in your body. Write like this:
body {
min-width: 1000px;
}
add this inside your HTMLhead:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
Actually this will prevent the user to zoom the content (wich sucks, from an user end experience):
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
Instead, in my opinion (and I am no guru), you should use:
<meta name="viewport" content="width=1000px">
Try setting a width for #outer_wrap and #wrap (you probably want 100%).
It looks like Mobile Safari is expanding the size of the #visual-portal-wrapper div, which isn't enough because Safari resizes text for iPhone display. You can change this with -webkit-text-size-adjust: none; but that would make the links rather undersized for iPhone users. That's why it fits in a normal browser but not in Mobile Safari.
Changing the width of the divs should stop them from having content expand beyond their edges (they're 974px by default because that's what #visual-portal-wrapper is, but all the contents overflow and cause the visual errors) and have the background images appear cut off. You might also want to add background positioning for #outer_wrap since it appears slightly off on the screenshot from what I'm seeing in Firefox.
Edit: Alternatively, you could try changing the width: 974px; on the #visual-portal-wrapper div to min-width: 974px;, of course making sure you account for IE's problems with min-width).