DEPRECATED - A front-end template that helps you build fast, modern mobile web apps.

Overview

Deprecation Note

Mobile Boilerplate is no longer maintained. Please use HTML5 Boilerplate as a decent starting point for your project.


Mobile Boilerplate

Mobile Boilerplate is a professional front-end template that helps you build fast and robust mobile web applications. Spend more time developing and less time reinventing the wheel.

Quick start

Clone the git repo - git clone https://github.com/h5bp/mobile-boilerplate.git - or download it

Features

  • Mobile browser optimizations.
  • CSS normalizations and common bug fixes.
  • The latest jQuery.
  • A custom Modernizr build for feature detection and a polyfill for CSS Media Queries.
  • Home page icon for Android, iOS, Nokia, Firefox.
  • Cross-browser viewport optimization for Android, iOS, Mobile IE, Nokia, and Blackberry.
  • Open Web App support for Firefox for Android and Firefox OS.
  • Better font rendering in Mobile IE.
  • iPhone web app meta.
  • INSTANT button click event.
  • Textarea autogrow plugin.
  • Hide URL bar method.
  • Prevent form zoom onfocus method.
  • Mobile site redirection.
  • User Agent Detection.
  • An optimized Google Analytics snippet.
  • Apache server caching, compression, and other configuration defaults for Grade-A performance.
  • Cross-domain Ajax.
  • "Delete-key friendly." Easy to strip out parts you don't need.
  • Extensive inline and accompanying documentation.

Documentation

Take a look at the documentation table of contents. This documentation is bundled with the project, which makes it readily available for offline reading and provides a useful starting point for any documentation you want to write about your project.

Contributing

Anyone and everyone is welcome to contribute.

Comments
  • Consider Zepto for mobile version of boilerplate

    Consider Zepto for mobile version of boilerplate

    Consider Zepto (by @madrobby) for mobile version of boilerplate, instead of jQuery. Just an idea. Moved here from boilerplate issue tracker.

    @paulirish said:

    We currently support non-webkit mobile environments and plan to remain that way for a bit. So zepto wont work. XUI however is worth considering..

    Mobile browser market share

    If your target group from South America, Africa or India you must worry about Opera Mini. All other popular mobile browsers is based on Webkit:

    • iOS (Safari)
    • Android (Chrome)
    • BlackBerry browser is based on Webkit and Mango
    • WebOS
    • Nokia (40 and 60 series)

    Sources: 1, 2

    javascript 
    opened by stereobooster 17
  • Consider changing all device- media queries to just straight max- min- MQs

    Consider changing all device- media queries to just straight max- min- MQs

    Scott Jehl (of jQuery Mobile, Filament Group, respond.js) has been doing a lot of work and doesn't see a case where the device- aspect is neccessary.

    We use the hardboiled media queries which uses device- heavily.

    Does anyone have a use case that is satisfied by device-max/min-width/height support only?

    opened by paulirish 15
  • Viewport config does not cater to fixed-width designs

    Viewport config does not cater to fixed-width designs

    This is arguably a corner-case, but I see it all the damn time anyway.

    A designer makes an awesome-looking PSD that's fixed at 320 or 480 pixels or something.

    That just doesn't work with the mobile paradigm, which thrives on fluid layout.

    You've gotta implement it anyway.

    Here's what you can do:

    Here's what that does:

    1. Android, iOS, and WP7 will render the page at the full width of the device, regardless of the device's own resolution.
    2. iOS and WP7 will not allow user rescaling; Android doesn't listen to user-scalable unfortunately and users are allowed to pinch/zoom (maybe this can be disabled via JS without killing scrolling).

    Fluid-width designs are harder to design and implement, that's all there is to it. People will continue to make fixed-width layouts, and this provides a friendly path which satisfies multiple platforms sufficiently.

    Is it a best-of-best practice? I'm not sure, but it's a good thing to know.

    html 
    opened by brianblakely 14
  • Build does not update js references in html

    Build does not update js references in html

    The build file minifies/concatenates the js, but does not update the path to the minified file.

    How to reproduce:

    Get a clean mobile boilerplate Build it open publish/index.html, notice the path the helper.js () navigate to that path, notice the file is not there.

    Steps to fix:

    Update the path to the minified and concatenated js file in html file. (see css file for example)

    build bug 
    opened by metallemon 12
  • Consider re-introducing test

    Consider re-introducing test

    In 4989cf9ee7442f49c85fb7f15c48d486075f3930 tests were removed from the repo. I want to suggest to re-introduce them in a lightweight form for helper.js since there is a lot of functionality. I think it is important to have some tests for the functions we write. Also it might help people get started with tests on their projects. Keeping them maintained shouldn't be that much of a problem I think.

    If there is a need for that I would love to submit a PR.

    new feature 
    opened by drublic 11
  • Remove Zepto and include jQuery 2.0.0

    Remove Zepto and include jQuery 2.0.0

    jQuery has become the de facto standard JavaScript library on the web. Switching to jQuery 2.0.0 means we remove support for Internet Explorer 6, 7 and 8.

    Reference #152.

    We should be aware that jQuery 2.0.0 is still bigger as Zepto: Zepto: 26.6 KB, 10.1 KB gzipped jQuery: 81.1 KB, 28.9 KB gzipped

    These numbers might be irrelevant when concatenating and minifying all scripts.

    opened by drublic 10
  • Reinstate `initial-scale=1` in meta viewport defaults?

    Reinstate `initial-scale=1` in meta viewport defaults?

    Now that iOS6 has finally fixed the infamous initial-scale bug on meta viewport handling, is it now time to reinstate initial-scale=1 as a default in MBP?

    Also, should the current bundled scaleFix helper now be limited to work on just iOS5 and below?

    Could it be removed even?

    html awaiting feedback 
    opened by alexgibson 9
  • Use sizes attribute for apple-touch-icon?

    Use sizes attribute for apple-touch-icon?

    Just throwing this in here for discussion - I'm not 100% sure what is best to use, but Apple now recommends using a new 'sizes' attribute for different resolution home screen icons. This was introduced in iOS 4.1.

    So, instead of using something like:

    <link rel="apple-touch-icon" media="screen and (max-resolution: 80dpi)" href="apple-touch-icon.png">

    <link rel="apple-touch-icon" media="screen and (min-resolution: 150dpi)" href="apple-touch-icon.png">

    They now suggest you use something like:

    <link rel="apple-touch-icon" href="apple-touch-icon-57x57.png" />

    <link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72.png" />

    <link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114x114.png" />

    The big question is, why do Apple suggest using this over max-resolution? I'm not actually 100% sure max-resolution worked correctly across every iOS device, but I could be wrong.

    I guess we also have to ask how many other platforms take notice and make use of this media query rule? Do any? If not, then I'd suggest following Apple's newer attribute?

    EDIT - I do understand other platforms use the apple-touch-cion link rel, but what I am talking about here is do they use the max-resolution rule also?

    Finally, it is also possible to provide these icons at different resolution without having to include the links in your HTML at all. So another thing to consider?

    More info here in Apple's docs:

    http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html#//apple_ref/doc/uid/TP40002051-CH3-SW4

    opened by alexgibson 9
  • Use conditional comment for IEMobile-specific meta tag that doesn't validate

    Use conditional comment for IEMobile-specific meta tag that doesn't validate

    index.html is not valid HTML5 because a value of cleartype is not permitted for the http-equiv attribute in <meta http-equiv="cleartype">. (Either that or http://www.w3.org/TR/html5/semantics.html#attr-meta-http-equiv is out of date, which I suppose is entirely possible since it's a work-in-progress and all that.)

    Assuming I'm not completely off base here and that producing valid HTML5 is important to the project, perhaps an acceptable solution is to enclose that invalid markup in a conditional comment like I've done here.

    The comments around the invalid markup already indicate that it's for Mobile IE.

    I believe the conditional comments are only supported on Windows Phone 7 and later, so I guess earlier phones will have to deal without the smoother typefaces. (I'm OK with that personally, but Windows Phones before Windows Phone 7 constitutes a vanishingly small portion of traffic to my sites.)

    opened by Trott 8
  • Invalid Type for element.addEventListener

    Invalid Type for element.addEventListener

    MBP.fastButton() uses invalid JavaScript by passing an object instead of a function to element.addEventListener. This throws an invalid type error in blackberry 6 browser.

    W3C specifies that the second argument to addEventListener needs to evaluate to a function.

    javascript 
    opened by alexmingoia 8
  • Revisit reasons for using target-densitydpi=160dpi

    Revisit reasons for using target-densitydpi=160dpi

    The idiot's guide to viewport and pixel ( https://docs.google.com/present/view?id=dkx3qtm_22dxsrgcf4 ) mentions the following:

    [Slide 5] "You will need to specify target-densitydpi=160dpi to make sure the consistency of device-width on Android, so with this applied, the device-width will always be 320px:"

    Afaict, this is not always correct: when used in landscape mode at 160dpi for instance, the Android browser and Opera Mobile 11 don't report a device-width of 320px, but rather of 426.6667px.

    Using a 160dpi setting seems to make the Android browser, Opera Mobile 11 indeed behave a bit more as an iPhone browser at first sight, but I'm not sure if it is something to rely on. It already behaves differently in landscape mode (due to its 3/4 aspect ratio instead of the iPhone's 3/2), and I wouldn't be surprised if this difference would be even more explicit on devices with non-standard form factors and high screen resolutions. Indeed, what will happen when we force 160dpi on retina screens (you can't test it on the iPhone as it doesn't support target-densitydpi)? My guess is that this will result in text that is way too small.

    Hence, the part on [Slide 6] "If left unspecified, it will not cause as much problem as the above, but you can't control the default dpi used, and that will cost inconsistency when used with CSS media query or JavaScript to detect screen width." does not make so much sense... Even if specifying it, you will encounter "inconsistencies" in the screen width (see previous paragraph). The good news is that we have media queries to catch those inconsistencies, so I don't see this as a "bug" we have to work around.

    So, all that to say that at present and unless I've misunderstood something, my advice would be to stick with width=device-width (leave it up to the browser to handle DPI stuff), and tweak images where needed with device-pixel-ratio specific overrides. Only in very specific cases you'll want to specify a target-densitydpi value.

    html 
    opened by andreasbovens 8
  • some doubts

    some doubts

    https://github.com/h5bp/mobile-boilerplate/blob/master/js/helper.js#L109

    does this here not point to MBP Object? MBP has no method 'addClickEvent' . I try to insepect in google develop tool: 2016-03-25 10 41 31

    opened by ssruoyan 0
  • Remove crossdomain.xml

    Remove crossdomain.xml

    Browsers disabled flash by reason of it secuire problems (but enabled it after fixes). Note sure that it still nessesary. Let's push browser native capabilities, not plugins.

    opened by frontenddeveloping 0
Owner
H5BP
H5BP
This is a template project demonstrating how the MERN stack(Mongo, Express, React, Node) can be used, here we have the back end implementation and there is the React implementation as the front end

Versão em português MERN stack This is a template project demonstrating how the MERN stack(Mongo, Express, React, Node) can be used, here we have the

Douglas Samuel Gonçalves 2 Jan 22, 2022
Webplate is an awesome front-end framework that lets you stay focused on building your site or app all the while remaining really easy to use.

Webplate Framework Webplate is an awesome front-end framework that lets you stay focused on building your site or app all the while remaining really e

Chris Humboldt 560 Nov 24, 2022
Starting a new JS app? Build, test and run advanced apps with kyt 🔥

kyt Every sizable JavaScript web app needs a common foundation: a setup to build, run, test and lint your code. kyt is a toolkit that encapsulates and

The New York Times 1.9k Dec 26, 2022
Node Express Template (NET.ts) - a small template project which help you to speed up the process of building RESTful API

Node Express Template (NET.ts) - a small template project which help you to speed up the process of building RESTful API

Przemek Nowicki 26 Jan 4, 2023
A toolkit for React, Preact, Inferno & vanilla JS apps, React libraries and other npm modules for the web, with no configuration (until you need it)

nwb nwb is a toolkit for: Quick Development with React, Inferno, Preact or vanilla JavaScript Developing: React Apps Preact Apps Inferno Apps Vanilla

Jonny Buchanan 5.5k Jan 3, 2023
An example of a mobile-first responsive web design

Mobile-First-RWD This demo is an example of a mobile-first responsive web design. This is a companion demo to the tutorial I wrote on HTML5 Rocks and

Brad Frost 68 Sep 24, 2022
Set up a modern web app by running one command.

Create React App Create React apps with no build configuration. Creating an App – How to create a new app. User Guide – How to develop apps bootstrapp

Facebook 98.4k Dec 28, 2022
Hi there! This is a react native starter which used to build a awesome Event Booking App based on the Figma design. You can download or clone it to speed up your projects.

mcrn-event-booking-app-starter Hi there! This is a react native starter which used to build a awesome Event Booking App based on the Figma design. You

Roy Chen 43 Dec 19, 2022
An upgradable boilerplate for Progressive web applications (PWA) with server side rendering, build with SEO in mind and achieving max page speed and optimized user experience.

React PWA v2 A highly scalable, Progressive Web Application foundation,boilerplate, with the best Developer Experience. Demo: https://demo.reactpwa.co

Atyantik 2.5k Dec 26, 2022
Opinionated SvelteKit Template for building web applications.

Opinionated SvelteKit Template for building web applications.

Manassarn 7 Jan 1, 2023
A boilerplate application for building Node.js back-end application in TypeScript

RESTful API Node Server Boilerplate A boilerplate/starter project for quickly building RESTful APIs and with typescript ?? Installation Install the de

Youssef Hajjari 14 Nov 23, 2022
Jekyllist - Modern Boilerplate on Jekyll

Jekyllist - Modern Boilerplate on Jekyll Jekyllist is a production ready boilerplate for humans who wants to build simple websites (portfolio sites, b

Atakan Oz 2 Jul 21, 2022
A simple Fast CLI that create Express+Mongoose MVC pattern

express-schema-generator Site | Docs | Contributing | Code of Conduct | Twitter | Chat Bored Writing and Creating the Same Express MVC Folders Again a

Shantanu Bombatkar 10 Aug 15, 2022
Full-Stack solution to quickly build PWA applications with Vue.js and Firebase

Welcome to bento-starter ?? ?? bento-starter is an Open-Source Full-Stack solution that helps you to build fast and maintainable web applications usin

Franck Abgrall 1.5k Jan 5, 2023
A cli tool to generate cra-template from current create-react-app project.

Create Cra Template A cli tool to generate cra-template from current create-react-app project. Create Cra Template Templates cra-template-popular cra-

Yoki 23 Aug 18, 2022
A generic template for starting Web3 Projects

Redwood WARNING: RedwoodJS software has not reached a stable version 1.0 and should not be considered suitable for production use. In the "make it wor

Dennison Bertram 18 Jun 28, 2022
Template repo for any node.js project

App Name The project uses: ESLint для линтинга кода, используется свой styleguide основанный на airbnb стандарте. prettier для форматирования кода. hu

Konstantin Aleksandrov 1 Dec 20, 2021
👩🏻‍💻 Developer Ready: A comprehensive template. Works out of the box for most Node.js projects.

node-typescript-boilerplate ????‍?? Developer Ready: A comprehensive template. Works out of the box for most Node.js projects. ???? Instant Value: All

IAD S.r.l. 6 Dec 15, 2022
A simple Vue3, Nuxt3 and Tailwind3 Starter Template

Nuxt 3 + Tailwind CSS 3 Starter This is a minimal starter template for Nuxt 3 projects with Tailwind CSS 3. It includes a simple template pages/index.

Rizkhal 1 Feb 11, 2022