blob: 63c0691cf13135c3d9ea3bd4eb189e72614152aa [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />
<meta name="description" content="Control the device status bar. ">
<title>
Statusbar - Apache Cordova
</title>
<link rel="SHORTCUT ICON" href="/favicon.ico"/>
<link rel="canonical" href="https://cordova.apache.org/docs/en/10.x/reference/cordova-plugin-statusbar/">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="/static/css/main.css">
<link rel="stylesheet" type="text/css" href="/static/css/lib/syntax.css">
<!-- Fonts -->
<!-- For attribution information, see www/attributions.html -->
<link href='https://fonts.googleapis.com/css?family=Raleway:700,400,300,700italic,400italic,300italic' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var disqus_developer = 1; // this would set it to developer mode
</script>
<!-- JS -->
<script defer type="text/javascript" src="/static/js/lib/jquery-2.1.1.min.js"></script>
<script defer type="text/javascript" src="/static/js/lib/bootstrap.min.js"></script>
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://analytics.apache.org/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '16']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body>
<header>
<a class="scroll-point pt-top" name="top"></a>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><img id="logo_top" src="/static/img/cordova-logo-newbrand.svg"/></a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<div class="nav_bar_center">
<ul class="nav navbar-nav">
<li class="active">
<a href="/docs/en/latest/">Documentation</a>
</li>
<li >
<a href="/plugins">Plugins</a>
</li>
<li >
<a href="/blog" id="blog_button">Blog<span class="badge" id="new_blog_count"></span></a>
</li>
<li >
<a href="/contribute">Contribute</a>
</li>
<li >
<a href="/contribute/team.html">Team</a>
</li>
<li>
<a href="/#getstarted">Get Started</a>
</li>
<li>
<form class="navbar-form navbar-right" id="header-search-form" role="search">
<div class="input-group">
</div>
</form>
</li>
</ul>
</div>
</div><!--/.navbar-collapse -->
</div>
</nav>
<div id="_fixed_navbar_spacer" style="padding-top:50px"></div>
</header>
<div class="docs">
<!-- Table of Contents -->
<div class="hidden-xs hidden-sm site-toc-container">
<ul class="site-toc">
<li>
<span class="toc-section-heading">
Introduction
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/guide/overview/index.html">
Overview
</a>
</li>
</ul>
</li>
<li>
<span class="toc-section-heading">
Create apps
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/guide/cli/index.html">
Create your first app
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/cli/template.html">
Templates for apps
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/support/index.html">
Platform support
</a>
</li>
<li>
<span class="toc-section-heading">
Develop for platforms
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/guide/platforms/android/index.html">
Android
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/ios/index.html">
iOS
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/windows/index.html">
Windows
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/osx/index.html">
OS X
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/electron/index.html">
Electron
</a>
</li>
</ul>
</li>
<li>
<a class="" href="/docs/en/10.x/platform_plugin_versioning_ref/index.html">
Manage versions and platforms
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/platform_pinning/index.html">
Platform pinning
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/config_ref/images.html">
Customize icons
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/cordova/storage/storage.html">
Store data
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/privacy/index.html">
Manage privacy
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/security/index.html">
Manage security
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/allowlist/index.html">
Allow List
</a>
</li>
</ul>
</li>
<li>
<span class="toc-section-heading">
Create plugins
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/guide/hybrid/plugins/index.html">
Create a plugin
</a>
</li>
<li>
<span class="toc-section-heading">
Develop for platforms
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/guide/platforms/android/plugin.html">
Android
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/ios/plugin.html">
iOS
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/windows/plugin.html">
Windows
</a>
</li>
</ul>
</li>
<li>
<a class="" href="/docs/en/10.x/plugin_ref/plugman.html">
Use Plugman
</a>
</li>
</ul>
</li>
<li>
<span class="toc-section-heading">
Advanced Topics
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/guide/hybrid/webviews/index.html">
Embed Cordova in native apps
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/next/index.html">
Next Steps
</a>
</li>
</ul>
</li>
<li>
<span class="toc-section-heading">
Reference
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/config_ref/index.html">
Config.xml
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/cordova/events/events.html">
Events
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-cli/index.html">
CLI Reference
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/hooks/index.html">
Hooks
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/plugin_ref/spec.html">
Plugin.xml
</a>
</li>
<li>
<span class="toc-section-heading">
Plugin APIs
</span>
<ul class="site-toc">
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-battery-status/index.html">
Battery Status
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-camera/index.html">
Camera
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-device/index.html">
Device
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-dialogs/index.html">
Dialogs
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-file/index.html">
File
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-geolocation/index.html">
Geolocation
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-inappbrowser/index.html">
Inappbrowser
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-media/index.html">
Media
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-media-capture/index.html">
Media Capture
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-network-information/index.html">
Network Information
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-screen-orientation/index.html">
Screen Orientation
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-splashscreen/index.html">
Splashscreen
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-statusbar/index.html">
Statusbar
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-vibration/index.html">
Vibration
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<!-- Page content -->
<div class="page-content-container">
<div class="page-content">
<div class="content-header">
<!-- ToC Dropdown (for XS and SM sizes only) -->
<div class="toc-dropdown dropdown visible-xs-block visible-sm-block">
<button class="btn btn-default dropdown-toggle" type="button" id="tocDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Table of Contents
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a class="" href="/docs/en/10.x/guide/overview/index.html">
Overview
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/cli/index.html">
Create your first app
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/cli/template.html">
Templates for apps
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/support/index.html">
Platform support
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/android/index.html">
Android
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/ios/index.html">
iOS
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/windows/index.html">
Windows
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/osx/index.html">
OS X
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/electron/index.html">
Electron
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/platform_plugin_versioning_ref/index.html">
Manage versions and platforms
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/platform_pinning/index.html">
Platform pinning
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/config_ref/images.html">
Customize icons
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/cordova/storage/storage.html">
Store data
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/privacy/index.html">
Manage privacy
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/security/index.html">
Manage security
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/allowlist/index.html">
Allow List
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/hybrid/plugins/index.html">
Create a plugin
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/android/plugin.html">
Android
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/ios/plugin.html">
iOS
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/platforms/windows/plugin.html">
Windows
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/plugin_ref/plugman.html">
Use Plugman
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/hybrid/webviews/index.html">
Embed Cordova in native apps
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/next/index.html">
Next Steps
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/config_ref/index.html">
Config.xml
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/cordova/events/events.html">
Events
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-cli/index.html">
CLI Reference
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/guide/appdev/hooks/index.html">
Hooks
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/plugin_ref/spec.html">
Plugin.xml
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-battery-status/index.html">
Battery Status
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-camera/index.html">
Camera
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-device/index.html">
Device
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-dialogs/index.html">
Dialogs
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-file/index.html">
File
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-geolocation/index.html">
Geolocation
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-inappbrowser/index.html">
Inappbrowser
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-media/index.html">
Media
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-media-capture/index.html">
Media Capture
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-network-information/index.html">
Network Information
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-screen-orientation/index.html">
Screen Orientation
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-splashscreen/index.html">
Splashscreen
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-statusbar/index.html">
Statusbar
</a>
</li>
<li>
<a class="" href="/docs/en/10.x/reference/cordova-plugin-vibration/index.html">
Vibration
</a>
</li>
</ul>
</div>
<a class="edit hidden-xs hidden-sm" href="https://github.com/apache/cordova-plugin-statusbar/blob/master/README.md"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> </a>
<!-- Version dropdown -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="versionDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
10.x
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="versionDropdown">
<!-- List versions available in this language -->
<li>
<a href="/docs/en/dev/" class="missing-page">
dev
</a>
</li>
<li>
<a href="/docs/en/latest/" class="missing-page">
12.x
(Latest)
</a>
</li>
<li>
<a href="/docs/en/11.x/" class="missing-page">
11.x
</a>
</li>
<li>
<a href="/docs/en/10.x/" class="missing-page">
<span class="selected">
10.x
</span>
</a>
</li>
<li>
<a href="/docs/en/9.x/" class="missing-page">
9.x
</a>
</li>
<li>
<a href="/docs/en/8.x/" class="missing-page">
8.x
</a>
</li>
<li>
<a href="/docs/en/7.x/" class="missing-page">
7.x
</a>
</li>
<li>
<a href="/docs/en/6.x/" class="missing-page">
6.x
</a>
</li>
<li>
<a href="/docs/en/5.4.0/" class="missing-page">
5.4.0
</a>
</li>
<li>
<a href="/docs/en/5.1.1/" class="missing-page">
5.1.1
</a>
</li>
<li>
<a href="/docs/en/5.0.0/" class="missing-page">
5.0.0
</a>
</li>
<li>
<a href="/docs/en/4.0.0/" class="missing-page">
4.0.0
</a>
</li>
<li>
<a href="/docs/en/3.6.0/" class="missing-page">
3.6.0
</a>
</li>
<li>
<a href="/docs/en/3.5.0/" class="missing-page">
3.5.0
</a>
</li>
<li>
<a href="/docs/en/3.4.0/" class="missing-page">
3.4.0
</a>
</li>
<li>
<a href="/docs/en/3.3.0/" class="missing-page">
3.3.0
</a>
</li>
<li>
<a href="/docs/en/3.2.0/" class="missing-page">
3.2.0
</a>
</li>
<li>
<a href="/docs/en/3.1.0/" class="missing-page">
3.1.0
</a>
</li>
<li>
<a href="/docs/en/3.0.0/" class="missing-page">
3.0.0
</a>
</li>
<li>
<a href="/docs/en/2.9.0/" class="missing-page">
2.9.0
</a>
</li>
<li>
<a href="/docs/en/2.8.0/" class="missing-page">
2.8.0
</a>
</li>
<li>
<a href="/docs/en/2.7.0/" class="missing-page">
2.7.0
</a>
</li>
<li>
<a href="/docs/en/2.6.0/" class="missing-page">
2.6.0
</a>
</li>
<li>
<a href="/docs/en/2.5.0/" class="missing-page">
2.5.0
</a>
</li>
<li>
<a href="/docs/en/2.4.0/" class="missing-page">
2.4.0
</a>
</li>
<li>
<a href="/docs/en/2.3.0/" class="missing-page">
2.3.0
</a>
</li>
<li>
<a href="/docs/en/2.2.0/" class="missing-page">
2.2.0
</a>
</li>
<li>
<a href="/docs/en/2.1.0/" class="missing-page">
2.1.0
</a>
</li>
<li>
<a href="/docs/en/2.0.0/" class="missing-page">
2.0.0
</a>
</li>
<li>
<a href="/docs/en/1.9.0/" class="missing-page">
1.9.0
</a>
</li>
<li>
<a href="/docs/en/1.8.1/" class="missing-page">
1.8.1
</a>
</li>
<li>
<a href="/docs/en/1.8.0/" class="missing-page">
1.8.0
</a>
</li>
<li>
<a href="/docs/en/1.7.0/" class="missing-page">
1.7.0
</a>
</li>
<li>
<a href="/docs/en/1.6.1/" class="missing-page">
1.6.1
</a>
</li>
<li>
<a href="/docs/en/1.6.0/" class="missing-page">
1.6.0
</a>
</li>
<li>
<a href="/docs/en/1.5.0/" class="missing-page">
1.5.0
</a>
</li>
</ul>
</div>
</div>
<!-- Show warnings for special versions -->
<!-- dev warning -->
<!-- outdated warning -->
<div class="alert docs-alert alert-danger" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
This version of the documentation is outdated!
<a href="/docs/en/latest/">
Click here for the latest released version.
</a>
</div>
<!-- plugin version warning -->
<div class="alert alert-warning docs-alert" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
master.
<a href="https://github.com/apache/cordova-plugin-statusbar/releases">
</a>
</div>
<div id="page-toc-source">
<!-- WARNING: This file is generated. See fetch_docs.js. -->
<!---
# license: Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-->
<table>
<thead>
<tr>
<th style="text-align: center">AppVeyor</th>
<th style="text-align: center">Travis CI</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center"><a href="https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-statusbar"><img src="https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-statusbar?branch=master" alt="Build status" /></a></td>
<td style="text-align: center"><a href="https://travis-ci.org/apache/cordova-plugin-statusbar"><img src="https://travis-ci.org/apache/cordova-plugin-statusbar.svg?branch=master" alt="Build Status" /></a></td>
</tr>
</tbody>
</table>
<h1>cordova-plugin-statusbar</h1>
<blockquote>
<p>The <code>StatusBar</code> object provides some functions to customize the iOS and Android StatusBar.</p>
</blockquote>
<h2>Installation</h2>
<p>This installation method requires cordova 5.0+</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cordova plugin add cordova-plugin-statusbar
</code></pre></div></div>
<p>It is also possible to install via repo url directly ( unstable )</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git
</code></pre></div></div>
<h2>Preferences</h2>
<h4>config.xml</h4>
<ul>
<li>
<p><strong>StatusBarOverlaysWebView</strong> (boolean, defaults to true). Make the statusbar overlay or not overlay the WebView at startup.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> &lt;preference name="StatusBarOverlaysWebView" value="true" /&gt;
</code></pre></div> </div>
<p>##### Android Quirks</p>
<p>Only supported on Android 5 or later. Earlier versions will ignore this preference.</p>
</li>
<li>
<p><strong>StatusBarBackgroundColor</strong> (color hex string, no default value). Set the background color of the statusbar by a hex string (#RRGGBB) at startup. If this value is not set, the background color will be transparent. If <code>StatusBarOverlaysWebView</code> is set to true, then a 8 digit hex (#AARRGGBB) string can optionally be used to define the transparency.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> &lt;preference name="StatusBarBackgroundColor" value="#000000" /&gt;
</code></pre></div> </div>
</li>
<li>
<p><strong>StatusBarStyle</strong> (status bar style, defaults to lightcontent). Set the status bar style (e.g. text color). Available options: <code>default</code>, <code>lightcontent</code>. <code>blacktranslucent</code> and <code>blackopaque</code> are also available, but <strong>deprecated</strong>, will be removed in next major release, use <code>lightcontent</code> instead.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> &lt;preference name="StatusBarStyle" value="lightcontent" /&gt;
</code></pre></div> </div>
</li>
<li>
<p><strong>StatusBarDefaultScrollToTop</strong> (boolean, defaults to false). On iOS, allows the Cordova WebView to use default scroll-to-top behavior. Defaults to false so you can listen to the &quot;statusTap&quot; event (described below) and customize the behavior instead.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code> &lt;preference name="StatusBarDefaultScrollToTop" value="false" /&gt;
</code></pre></div> </div>
</li>
</ul>
<h3>Android Quirks</h3>
<p>The Android 5+ guidelines specify using a different color for the statusbar than your main app color (unlike the uniform statusbar color of many iOS apps), so you may want to set the statusbar color at runtime instead via <code>StatusBar.backgroundColorByHexString</code> or <code>StatusBar.backgroundColorByName</code>. One way to do that would be:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">if</span> <span class="p">(</span><span class="nx">cordova</span><span class="p">.</span><span class="nx">platformId</span> <span class="o">==</span> <span class="dl">'</span><span class="s1">android</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">StatusBar</span><span class="p">.</span><span class="nx">backgroundColorByHexString</span><span class="p">(</span><span class="dl">"</span><span class="s2">#333</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>
<p>It is also possible to make the status bar semi-transparent. Android uses hexadecimal ARGB values, which are formatted as #AARRGGBB. That first pair of letters, the AA, represent the alpha channel. You must convert your decimal opacity values to a hexadecimal value. You can read more about it <a href="https://stackoverflow.com/questions/5445085/understanding-colors-on-android-six-characters/11019879#11019879">here</a>.</p>
<p>For example, a black status bar with 20% opacity:</p>
<div class="language-js highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">if</span> <span class="p">(</span><span class="nx">cordova</span><span class="p">.</span><span class="nx">platformId</span> <span class="o">==</span> <span class="dl">'</span><span class="s1">android</span><span class="dl">'</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">StatusBar</span><span class="p">.</span><span class="nx">overlaysWebView</span><span class="p">(</span><span class="kc">true</span><span class="p">);</span>
<span class="nx">StatusBar</span><span class="p">.</span><span class="nx">backgroundColorByHexString</span><span class="p">(</span><span class="dl">'</span><span class="s1">#33000000</span><span class="dl">'</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>
<h3>iOS Quirks</h3>
<p>Starting with iOS 11 you must include <code>viewport-fit=cover</code> in your viewport meta tag if you want the status bar to overlay the webview:</p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;meta</span> <span class="na">name=</span><span class="s">"viewport"</span> <span class="na">content=</span><span class="s">"initial-scale=1, width=device-width, viewport-fit=cover"</span><span class="nt">&gt;</span>
</code></pre></div></div>
<h2>Hiding at startup</h2>
<p>During runtime you can use the StatusBar.hide function below, but if you want the StatusBar to be hidden at app startup on iOS, you must modify your app&#39;s Info.plist file.</p>
<p>Add/edit these two attributes if not present. Set <strong>&quot;Status bar is initially hidden&quot;</strong> to <strong>&quot;YES&quot;</strong> and set <strong>&quot;View controller-based status bar appearance&quot;</strong> to <strong>&quot;NO&quot;</strong>. If you edit it manually without Xcode, the keys and values are:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;key&gt;UIStatusBarHidden&lt;/key&gt;
&lt;true/&gt;
&lt;key&gt;UIViewControllerBasedStatusBarAppearance&lt;/key&gt;
&lt;false/&gt;
</code></pre></div></div>
<h2>Methods</h2>
<p>This plugin defines global <code>StatusBar</code> object.</p>
<p>Although in the global scope, it is not available until after the <code>deviceready</code> event.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(StatusBar);
}
</code></pre></div></div>
<ul>
<li>StatusBar.overlaysWebView</li>
<li>StatusBar.styleDefault</li>
<li>StatusBar.styleLightContent</li>
<li>StatusBar.styleBlackTranslucent</li>
<li>StatusBar.styleBlackOpaque</li>
<li>StatusBar.backgroundColorByName</li>
<li>StatusBar.backgroundColorByHexString</li>
<li>StatusBar.hide</li>
<li>StatusBar.show</li>
</ul>
<h2>Properties</h2>
<ul>
<li>StatusBar.isVisible</li>
</ul>
<h2>Events</h2>
<ul>
<li>statusTap</li>
</ul>
<h1>StatusBar.overlaysWebView</h1>
<p>Make the statusbar overlay or not overlay the WebView.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.overlaysWebView(true);
</code></pre></div></div>
<h2>Description</h2>
<p>Set to true to make the statusbar overlay on top of your app. Ensure that you adjust your styling accordingly so that your app&#39;s title bar or content is not covered. Set to false to make the statusbar solid and not overlay your app. You can then set the style and background color to suit using the other functions.</p>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android 5+</li>
</ul>
<h2>Quick Example</h2>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.overlaysWebView(true);
StatusBar.overlaysWebView(false);
</code></pre></div></div>
<h1>StatusBar.styleDefault</h1>
<p>Use the default statusbar (dark text, for light backgrounds).</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.styleDefault();
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android 6+</li>
<li>Windows</li>
</ul>
<h1>StatusBar.styleLightContent</h1>
<p>Use the lightContent statusbar (light text, for dark backgrounds).</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.styleLightContent();
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android 6+</li>
<li>Windows</li>
</ul>
<h1>StatusBar.styleBlackTranslucent</h1>
<p>Note: <code>styleBlackTranslucent</code> is <strong>deprecated</strong> and will be removed in next major release, use <code>styleLightContent</code> instead.</p>
<p>Use the blackTranslucent statusbar (light text, for dark backgrounds).</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.styleBlackTranslucent();
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android 6+</li>
<li>Windows</li>
</ul>
<h1>StatusBar.styleBlackOpaque</h1>
<p>Note: <code>styleBlackOpaque</code> is <strong>deprecated</strong> and will be removed in next major release, use <code>styleLightContent</code> instead.</p>
<p>Use the blackOpaque statusbar (light text, for dark backgrounds).</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.styleBlackOpaque();
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android 6+</li>
<li>Windows</li>
</ul>
<h1>StatusBar.backgroundColorByName</h1>
<p>On iOS, when you set StatusBar.overlaysWebView to false, you can set the background color of the statusbar by color name.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.backgroundColorByName("red");
</code></pre></div></div>
<p>Supported color names are:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android 5+</li>
<li>Windows</li>
</ul>
<h1>StatusBar.backgroundColorByHexString</h1>
<p>Sets the background color of the statusbar by a hex string.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.backgroundColorByHexString("#C0C0C0");
</code></pre></div></div>
<p>CSS shorthand properties are also supported.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.backgroundColorByHexString("#333"); // =&gt; #333333
StatusBar.backgroundColorByHexString("#FAB"); // =&gt; #FFAABB
</code></pre></div></div>
<p>On iOS, when you set StatusBar.overlaysWebView to false, you can set the background color of the statusbar by a hex string (#RRGGBB).</p>
<p>On Android, when StatusBar.overlaysWebView is true, and on WP7&amp;8, you can also specify values as #AARRGGBB, where AA is an alpha value.</p>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android 5+</li>
<li>Windows</li>
</ul>
<h1>StatusBar.hide</h1>
<p>Hide the statusbar.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.hide();
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android</li>
<li>Windows</li>
</ul>
<h1>StatusBar.show</h1>
<p>Shows the statusbar.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>StatusBar.show();
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android</li>
<li>Windows</li>
</ul>
<h1>StatusBar.isVisible</h1>
<p>Read this property to see if the statusbar is visible or not.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>if (StatusBar.isVisible) {
// do something
}
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
<li>Android</li>
<li>Windows</li>
</ul>
<h1>statusTap</h1>
<p>Listen for this event to know if the statusbar was tapped.</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>window.addEventListener('statusTap', function() {
// scroll-up with document.body.scrollTop = 0; or do whatever you want
});
</code></pre></div></div>
<h2>Supported Platforms</h2>
<ul>
<li>iOS</li>
</ul>
</div>
</div>
<div class="row">
<div class="blue-divider"></div>
<footer>
<div class="container-fluid">
<div class="row">
<div class="col-sm-9">
<h1>More Resources</h1>
<div class="row">
<div class="col-sm-4">
<h2>General</h2>
<ul class="nav">
<li>
<a target="_blank" href="https://projects.apache.org/project.html?cordova">Apache Project Page</a>
</li>
<li>
<a href="https://www.apache.org/dyn/closer.cgi/cordova">Source Distribution</a>
</li>
<li>
<a target="_blank" href="https://www.apache.org/licenses">License</a>
</li>
<li>
<a href="/artwork">Artwork</a>
</li>
</ul>
</div>
<div class="col-sm-4">
<h2>Development</h2>
<ul class="nav">
<li><a target="_blank" href="https://github.com/apache?utf8=%E2%9C%93&amp;q=cordova-">Source Code</a></li>
<li><a target="_blank" href="https://github.com/apache/cordova#filing-a-bug">Issue Tracker</a></li>
<li><a target="_blank" href="https://stackoverflow.com/questions/tagged/cordova">Stack Overflow</a></li>
<li><a href="/contact">Mailing List</a></li>
<li><a href="/contribute/nightly_builds.html">Nightly builds</a></li>
</ul>
</div>
<div class="col-sm-4">
<h2>Apache Software Foundation</h2>
<ul class="nav">
<li>
<a target="_blank" href="https://www.apache.org/">About ASF</a>
</li>
<li>
<a target="_blank" href="https://www.apache.org/events/current-event">Events</a>
</li>
<li>
<a target="_blank" href="https://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a>
</li>
<li>
<a target="_blank" href="https://www.apache.org/foundation/thanks.html">Thanks</a>
</li>
<li>
<a target="_blank" href="https://www.apache.org/security/">Security</a>
</li>
<li>
<a target="_blank" href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy policy</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-sm-3">
<h1>Contribute</h1>
<p style="padding-top:20px"><strong>Help Cordova move forward!</strong></p>
<p>Report bugs, improve the docs, or contribute to the code.</p>
<a href="/contribute" class="btn btn-lg btn-primary">
Learn More
</a>
<p style="padding-top:20px"> <a href="https://twitter.com/apachecordova" class="twitter-follow-button" data-show-count="false">Follow @apachecordova</a></p>
</div>
</div>
<p class="copyright_text">
Copyright &copy; 2024 <a href="https://apache.org">The Apache Software Foundation</a>, Licensed under the <a target="_blank" href="https://www.apache.org/licenses/">Apache License, Version 2.0</a>.<br/>
Apache and the Apache feather logos are <a target="_blank" href="https://www.apache.org/foundation/marks/list/">trademarks</a> of The Apache Software Foundation.
<br/>
<p>See the <a href="/attributions/">attributions page</a> for other copyright & trademark notices.</p>
</p>
</div>
</footer>
</div>
</div>
</div>
<script defer type="text/javascript" src="/static/js/lib/toc.min.js"></script>
<script defer type="text/javascript" src="/static/js/docs.js"></script>
<script defer type="text/javascript" src="/static/js/index.js"></script>
<script defer type="text/javascript" src="/static/js/twitter.js"></script>
</body>
</html>