Carlos Mendoza Carlos Mendoza - 1 year ago 60
Node.js Question

Unable to expand collapsed navbar in Bluemix deployed app

I am deploying a very simple node.js application in bluemix. I am using ejs and bootstrap to create a navbar at the top. It works on my local version of the code, but when I push it to bluemix and deploy, the navbar doesn't expand. Interestingly the source code for both apps as seen by the browser is exactly the same. Here is the code:

<!-- views/pages/start.ejs -->

<!DOCTYPE html>
<html lang="en">
<!-- views/partials/head.ejs -->

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Some Title</title>

<!-- CSS (load bootstrap from a CDN) -->
<link rel="stylesheet" href="//">
<script src=""></script>
<script src=""></script>

body { position: relative; padding-top:50px; }


<body class="container" data-spy="scroll" data-target=".navbar" data-offset="50">

<!-- views//partials/header.ejs -->

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<a class="navbar-brand" href="#">Website</a>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="#section1">Section 1</a></li>
<li><a href="#section2">Section 2</a></li>
<li><a href="#section3">Section 3</a></li>

Answer Source

When you load your app in Bluemix, does your browser show a "shield" icon in the address bar? If so, you might be running into mixed content blocking. This basically means the browser refuses to run external content served over HTTP when the rest of the website is served over HTTPS.

The easiest way to fix it is by changing your external resources to all https:// URLs:

<link rel="stylesheet" href="">
<script src=""></script>
<script src=""></script>

For security, you should always load your Bluemix app using its https:// URL as well.