I have been searching for a solution to my specific problem, but I haven't found one that works for me.
Here is the issue at hand:
My responsive website displays an info-box when accessed from a mobile device. This info-box contains a link to a tutorial on how to save the site as a WebApp. However, when the user accesses the website from a WebApp, the info-box should be hidden.
Below is the code I am currently using (which is not functioning):
<script type="text/javascript>
if (window.navigator.standalone == true) {
document.getElementById('alertbox')[0].style.display = 'none !important';
}
</script>
The ID of the info-box is "alertbox":
<div id="alertbox" class="alert alert-info visible-phone">
<button type="button" class="close" data-dismiss="alert>×</button>
This website supports iOS-WebApps. Learn more <a href="/guides/ios-webapp>how to save this website as a WebApp</a>.
</div>
The use of "!important" is necessary because I am utilizing Twitter's BootStrap which has already defined the sub-attribute (display) as !important.
Thank you in advance.