HTML5 Full Screen Web Apps: No browser bars - html

I am creating a HTML5 web app for mobile devices and was asked to hide the browser nav bar (the back & forward buttons) (typo here prev.). How can I achieve that?
I think I should be able to achieve that using Phone Gap. But I wonder if its possible for a "normal" web app to hide the browser bar? I think its possible if I pin the web site/app to the home screen?
iPhone has http://ajaxian.com/archives/iphone-full-screen-webapps, but what about Andriod at least?

I know this question is a bit out of date at this point so here is an update:
On Safari for iOS 7+ this solution is great:
<meta name="viewport" content="minimal-ui, width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
The minimal-ui attribute makes the browser hide all the buttons while keeping the taskbar intact.
I have not tested this for android.

If you can use JQuery in your web-app than I would suggest you to go for NiceScroll plugin.
It can be used for both mobile and desktop browsers and will hide the browser's scrollbars. If your code is going beyond the viewport height of browser than it will make a custom scrollbar which will fadeout if not in use.
Here is its Demo.
Edit:
As per your update, I would like to add that I am actually not a native mobile web-app developer but while searching for your problems I found some SO questions that can help you to lead the way further:
Removing address bar from browser (to view on Android)
Fullscreen Web App for Android
And these tutorials:
Full Screen Web Apps
Best Practices for Web Apps

You could use this application for Android: Kiosk Web/Html Browser, it creates a folder in your sd card where you can put the html, showed in fullscreen "immersive mode".

<script> function requestFullScreen() {
var el = document.body;
// Supports most browsers and their versions.
var requestMethod = el.requestFullScreen || el.webkitRequestFullScreen
|| el.mozRequestFullScreen || el.msRequestFullScreen;
if (requestMethod) {
// Native full screen.
requestMethod.call(el);
} else if (typeof window.ActiveXObject !== "undefined") {
// Older IE.
var wscript = new ActiveXObject("WScript.Shell");
if (wscript !== null) {
wscript.SendKeys("{F11}");
}
}
}
</script>
click

There's such function in the latest Chrome for Android beta:
https://developers.google.com/chrome/mobile/docs/installtohomescreen

EDIT
New answer
Much has change since this question was asked. There now is good native support for scrolling, fixed position, and the browser bar of most OS is a lot smaller then back then. Since this is the case I would advice not to resort to scrolling hacks as most sites and answers recommend. Sticking to the rules of the OS will improve the stability, usability and future compatibility of your webapp.
Old answer
It's possible for iPhone when somebody saves it as a webapp to the homescreen. This works if you add the proper meta tags.
For the standard browsermode it's a bit trickier you have to fallback to hacks. Basically the address bar disappears when you scroll (for Iphone and most of the times for android). You can fake this with javascript. Mobile tuts also has a good article on it:
http://mobile.tutsplus.com/tutorials/mobile-web-apps/remove-address-bar/, but this only works when content is longer the screen resolution.

Related

The responsive development tools on chrome or safari seem to render the page wrong

I'm building a web app using the create-react-app toolkit. I'm trying to make my website as mobile friendly as possible. I'm initially designing for an iPhone 5 because that is one of the smallest phones around and because it's the phone I have. When I render my website using Chrome or Safari developer tools, the page renders very much different than when I open the page directly on my iPhone. Both Chrome and Safari developer tools have iPhone5 viewpoint defined as 320x568 however that doesn't account for the bar at the top and bottom of the page. In Safari the ACTUAL viewpoint size for my iPhone5 is 320x460 when the page first loads, and after you start scrolling down it expands to 320x529. I figured this out using:
window.addEventListener('resize', function(event){
console.log('width: ' + window.innerWidth);
console.log('height: ' + window.innerHeight);
});
HOWEVER, even when I change the size of the viewport in my developer tools to those values (both Chrome and Safari), it still looks different than the actual iPhone.
I've been unable to find similar problems/solutions to this problem on stack or anywhere else and I want to know if there's a way to make sure the page is viewed correctly on all devices?
Thank you in advance
iPhone 5 Web Design Specs

How to disable zoom on mobile website for ios devices using metatag?

I need to disable zoom on mobile website using metatag which is fixed for Android but I am searched more for ios metatag..It is not fixed..
Disabling zoom in websites through the meta tag is not possible anymore.
Safari even mentioned this in it's release notes.
To improve accessibility on websites in Safari, users can now
pinch-to-zoom even when a website sets user-scalable=no in the
viewport.
You could try disabling with javascript though:
document.addEventListener('gesturestart', function(e){ e.preventDefault(); });
https://developer.mozilla.org/en-US/docs/Web/Events/gesturestart

Zoom in on Bootstrap mobile

I'm putting together responsiveness for a client of mine (the site is using Bootstrap 2) but I'm having an issue. When I visit the site on my mobile device (HTC X8) I notice that it isn't really zoomed in to where it would look good.
Here is the link I'm using, and the result on my phone: http://www.gigee.me/draft/index.php?/account/login (if the site redirects you to just gigee.me, type in the rest of /draft/index.php?/account/login and it should work)
However, I want it to be more zoomed-in. Just like it looks when you are scaling down in a browser.
I think this might be a simple fix. I believe most of my HTML and CSS is correct.
I would really appreciate any and all help with this.
Most mobile devices utilize what is called a "virtual viewport". Essentially, what this means is that even though the device itself is relatively very small compared to a regular laptop / desktop monitor, it still displays at a high resolution. For example, newer versions of the iPhone and iPad both display at a virtual viewport of 980px. So even though you have a Bootstrap 2 responsive website with breakpoints at 768px and 980px, your phone is actually displaying the website at the desktop or tablet version since its virtual viewport is most likely higher than its actual viewport.
What you need is to detect phones (and tablets if you choose) and tell the document to render a viewport zoom if the user is using a mobile device.
In your HTML head tags, add the following
<meta name = "viewport" id = "viewport_device">
Then include the following JavaScript in your document after the jQuery library reference
if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/IEMobile/i)){
$("#viewport_device").attr("content", "initial-scale = 0.50");
}
else if(navigator.userAgent.match(/iPad/i)){
$("#viewport_device").attr("content", "initial-scale = 1.00");
}
The IF statement will detect all major mobile browsers. If a phone is detected, the initial-scale is set to 0.50. This is essentially telling the browser to zoom in 50%. If an iPad is detected, then the initial scale is set to 1. Depending on your page, you might want to play with these values to see what values look best for your site.

Disable zooming on page in chrome

For a HTML game I want to disable the normal zooming functionality in Chrome.
This question talks about how to use the viewport meta tag to disable zoom in Chrome on Android but this does not seem to work in normal desktop chrome.
While this doesn't answer my original question (I asked about a page displayed in Chrome) I just wanted to document that Chromium (the OSS behind Chrome) seems to have a flag which controls whether it will support the viewport meta tag:
// Enables the use of the viewport meta tag, which allows
// pages to control aspects of their own layout. This also turns on touch-screen
// pinch gestures.
const char kEnableViewport[] = "enable-viewport";
(soure: http://src.chromium.org/svn/trunk/src/content/public/common/content_switches.cc)
So, if packaging the game into its own chromium instance is an option (which in my case is likely), zooming could be disabled via the viewport meta tag.

Fullscreen webpage presentation

I am developing a web system for training and the trainer can show the content by zooming with the css3 property that increases the size of the screen.
What I'm trying to achieve is a PowerPoint style presentation, which fills the screen. The problem is that my webpage can be a combination of HTML, Flash, image or audio, or even 4 at a time.
How can I accomplish this? One idea I have is to create an image of the contents of the webpage and attach it to a flash and put it in full screen. Is there a better solution or maybe some software or something?
Thanks in advance for the help.
EDIT
I know browser have the functionality to go full screen, but what I'm trying to do is take a part of the webpage (because in the page are the menu, toolbars, etc) that is in a div.
HTML5 Fullscreen API:
http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/
// mozilla proposal
element.requestFullScreen();
document.cancelFullScreen();
// Webkit (works in Safari and Chrome Canary)
element.webkitRequestFullScreen();
document.webkitCancelFullScreen();
// Firefox (works in nightly)
element.mozRequestFullScreen();
document.mozCancelFullScreen();
// W3C Proposal
element.requestFullscreen();
document.exitFullscreen();
Also, check out this for making a presentation with HTML5:
http://slides.html5rocks.com/#landing-slide
It seems to me that it's best to let the user control this. F11 works in all browsers (that I know of) to toggle full-screen on and off.
HTH
Most browsers support pushing F11 to go into full screen mode....
Most web browsers have a full screen mode - hit F11 on a Windows machine with either Internet Explorer or Firefox and they will go full screen. Hit escape to exit full screen.
You may also want to conside using S5 ( http://meyerweb.com/eric/tools/s5/ ) to make HTML based presentations.
Good luck!
https://www.w3schools.com/howto/howto_js_fullscreen.asp
This use element.requestFullscreen() method